Showing posts with label Selenium WebDriver. Show all posts
Showing posts with label Selenium WebDriver. Show all posts

2013-01-02

How to install TestNG in Eclipse?

In this article we are going to see how to install TestNG in Eclipse IDE to use with selenium webdriver. I am using j2ee with Eclipse (Indigo Service Release 2).

For the basic webdriver and Eclipse IDE setup, please follow my old post .

Please go through following steps to setup TestNG in eclipse

Step 1 : Run Eclipse and Click "Help"


Step 2 : Click "Install New Software"

Step 3 : Click "Add" from right upper side
 

Step 4 : Write "TestNG" as Name and "http://beust.com/eclipse" as Location

Step 5 : Click Ok and you see TestNG loaded. Select that check box  and press next
 

Step 6 : Complete the installation process by accepting , allowing terms & conditions . In the last point Eclipse will download and install total package. It will then prompt for restarting Eclipse. Restart Eclipse.

We have completed installation. Now let's check.
- Click Window -> Show View -> Others

We will get a view selecting window.

Select TestNG under Java and Click ok. We can see there is another view added in the bottom(my preference) of the eclipse.


To Run a project as TestNG project, we can get another option from Run -> Run As -> "TestNG Test".
 

Now We are ready to run our selenium test with TestNG. 

Why we need TestNG instead of JUnit. The main advantages for using TestNG are
- All major JAVA IDEs  Eclipse, IntelliJ IDEA, and NetBeans support TestNG.
- TestNG can be integrated in Apache Maven build system with custom tasks for Apache Ant (Selenium test can be run on nighty builds)
- Continuous Integration using Hudson has built in support for TestNG.
There are more at TestNG website.

In separate post, I will write how to write code for TestNG in selenium web driver. 
...Thanks...:)