Installing TestNG
Installing Eclipse Plugin for TestNG
1. Download the TestNG eclipse plugin from (http://beust.com/eclipse/)
2. Copy the downloaded jar file into following directory structure
3. Create the “TestNG.link” file in ‘links’ folder of Eclipse installation
4. Edit the file to provide the path of plugin
path=C:/Eclipse - Helios/eclipse-jee-helios-win32/eclipse/ExternalPlugins/TestNG
5. Restart the Eclipse.
Verifying Installation
1. Open Windows -> Show Views -> Others to see if TestNG is listed as follows
Testing ( A simple Example )
1. Create a TestNG class.
2. Specify the following details. For more details on the annotations visit the TestNG site. They are pretty much same as Junit annotations.
3. You also need to add the ‘testng.jar’ file so that the annotations can be recognized. In order to add this to your projects classpath. Select ‘Configure Build Path -> Add Variable -> Select the TESTNG_HOME -> Extend Variable to include testng.jar’
4. Following generated Class should now be compiled
5. Creating a ‘Launch Configuration’
6. In the launch configuration select the TestNG class
8. Above steps tested a method “f()” . The test was successful because there was no error or exceptions encountered in the method “f()” .
10. Run the same Launch Configuration, and see the test results as below