Getting started with TestNG in Eclipse

In this blogpost, we will see how to configure how to a TestNG project in Eclipse IDE, and run a simple TestNG test case.

If you have not installed TestNG plugin in Eclipse IDE, visit Installation of TestNG in Eclipse IDE.

Step 1 : Create a Java project in Eclipse

Open Eclipse IDE.

Go to File -> New -> Java Project, and finish the process by giving project name and selecting JRE version .

For more information on this, visit this link.

Step 2 : Add TestNG library to build path of the project

Once after creating a Java project, we need to add the TestNG library to the build path of the project in order to utilize TestNG capabilities.

In order to add the library to build path, follow below steps

Right click on the project -> Build Path -> Configure build Path

TestNG_Create_Simple_TestNG_Project.png

After clicking on the Configure Build Path button, a dialog box for configuring project properties will be prompted. Click on Add Library button from the dialog box.

 

TestNG_Create_Simple_TestNG_Project_Add_Library.png

After clicking Add Library button, the wizard for adding library will be prompted, select TestNG from the list, click Next/ Finish button.

TestNG_Create_Simple_TestNG_Project_Add_Library2.png

Once after clicking Next/ Finish button, TestNG would have been added in the Libraries, and you would be able to see it in Project Explorer, as shown below.

TestNG_Create_Simple_TestNG_Project_Explorer_Library_added

 

Advertisements

#create-a-testng-project-in-eclipse, #getting-started-with-testng