November 4, 2017

Tinkering with Twitter: Setting up an API Testing environment with Twitter4J

This is Part Three of a multi-part blog series on putting together a basic API test framework for the Twitter Search API. Care to go back to the beginning

The last few posts we covered a lot of ground:

For this entry, we will be walking a user through setting up an API development environment with IntelliJ, Java, and Twitter4J.

Step One: Download and Install IntelliJ IDEA

Step Two: Set Up a New Project

  • Run IntelliJ IDEA. The main splash screen should appear.

The IntelliJ IDEA splash screen

  • From the splash screen, select "Create Project".
  • This time, let's create a  Maven project. Select "Maven" in the left-hand menu, make sure that Java 1.8 is selected, and hit "Next".

Select Maven, the Java 1.8 SDK, and choose "Next". 
  • What do you want to use as a group id? Since I have my website "", I used that as a package name: com.tjmaher. 
  • What do you want to call the project? I selected TinkeringWithTwitter as a name. Select "Next". 

Enter a group id, artifact id, and keep the default snapshot version. Select "Next". 

  • Select "Finish" on the next screen. 
  • Your Java project is now set up!

Step Three: Set up the Twitter4J Dependencies in the POM.Xml file
  • Review the "Maven Integration" section on the main page for Twitter4J on
  • Go to the pom.xml file that was created automatically in the root folder of the project.
  • If it is not there already, after the group id, artifact id, and version, add the dependency block, placing the group id, artifact id, and version for Twitter4J inside it. It will look something like this: 

  • The Twitter4J Java Library should automatically download. 
  • We will include the test framework TestNG.

Step Four: Set up the Twitter credentials for Twitter4J to use

  • Once you are at the root folder of the project, create a new file by going to the horizontal menu, and select File -> New -> File.
  • Create a new file "".
  • Copy and paste the following code into the

  • Did you create a new Twitter account, create a Twitter app, and get credentials that this project could use? If not, follow the instructions.
  • Cut-and-paste the consumer key, consumer secret, access token, and access token secret into the file, replacing the asterisks. 

... Now, our project is all set! Next, we will work through posting Tweets to your Twitter account using Twitter4J!

Happy Testing!

-T.J. Maher
Twitter | LinkedIn | GitHub

// Sr. QA Engineer, Software Engineer in Test, Software Tester since 1996.
// Contributing Writer for TechBeacon.
// "Looking to move away from manual QA? Follow Adventures in Automation on Facebook!"


shoaib said...

Free Crack Softwares said...

I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
Very interesting blog.visit my wepsite

JetBrains PhpStorm Crack

Resolume Arena crack

SmartDraw crack

Wondershare Filmora crack

Katherine said...

It is very informative. Very easy to understand. Great work team. Keep me updated for all such articles
Your work is great it provides me great knowledge visit below links..
Avast Premier Crack
SmartDraw Crack
CleanMyMac X Crack
Sketchup Pro Crack

vé máy bay từ canada về việt nam said...

Mua vé máy bay tại Aivivu, tham khảo

Vé máy bay đi Mỹ

vé máy bay từ mỹ về việt nam mùa dịch

giá vé máy bay từ đức về việt nam

chuyến bay từ nga về việt nam

vé máy bay từ anh về việt nam vietnam airlines

các chuyến bay từ châu âu về việt nam

giá vé máy bay tết