TestNG framework is for Java so make sure that JDK installed and also eclipse because we are using eclipse to work with TestNG.
Install Java Software Development Kit (SDK) from below link http://www.oracle.com/technetwork/java/javase/downloads/index.html
To set environment for Java:
Set the JAVA_HOME environment variable to the base directory location where Java is installed.
For windows to set the environment variable JAVA_HOME: C:\ProgramFiles\Java\jdk1.8.0_25
For Linux Export JAVA_HOME=/usr/local/java-current
For MacExport JAVA_HOME=/Library/Java/Home
To add Java compiler location to System Path:
For windows add the path C:\Program Files\Java\jdk1.8.0_25\bin at end of system variable Path by putting semicolon at the end. Do not delete/edit old path.
For Linux Export PATH=$PATH:$JAVA_HOME/bin/
For Mac not required
To verify Java Installation using the command javac:
Go to command prompt and type the command javac you should get this out if java is successfully installed.
Here in eclipse we are enabling TestNG. We can also execute JUnit test outside the eclipse that is discussed in future topics.
Steps to enable TestNG in eclipse:
Note: TestNG is not built in eclipse
In order to install TestNG follow below steps:
- Go to help in eclipse, click on Install New software
- To start installation process, click the Add button as shown:
- Now enter the name as TestNG and in the "Location", type the URL: http://beust.com/eclipse, click ok button:
- Click “Select All”, then check the “TestNG” then click “Next”:
- Click 'Next' to begins the installation process:
- Here click the radio button "I accept the terms of the license agreement" and then click Finish button.
- Now the installation process starts ,Wait for the installation to finish
- We will get Security warning dialog box, click OK
- Software Updates dialog box will pop-up to restarteclipse, click "Yes".
Verify the setup of TestNG
To verify the setup of TestNG: