In this article we will see how to install TestNG in Eclipse. Installing TestNG is very easy in eclipse. Please follow step-to-step screens in this tutorial to install it in Eclipse.
If you don’t have TestNG installed you won’t get the option to run the tests with TestNG option in eclipse.
We can easily install TestNG via Eclipse Marketplace . Go to Help > Eclipse Marketplace…
In Eclipse marketplace search for TestNG and click on Go button.
Click Install button for TestNG for Eclipse plug-in.
Check all the features and click confirm .
Read and Accept the license for the TestNG eclipse plugin .
Eclipse will start installing when you click on the Finish button as shown in above figure.
After install you would need to restart your eclipse . You would get an alert to restart eclipse at the end at the installation. Click OK and restart your eclipse.
You are done with installation of TestNG plug-in in eclipse. You can right click any @Test method class or the TestNG suite file to check the run with TestNG option.
Right click any class which has @Test method in it . You will see option to run as TestNG test.
Alternatively , right click the suite file to get the option to run as TestNG suite file as shown in the below screenshot.
Selecting this option would make TestNG run your entire suite file and all the tests in it.
The steps shown above would be almost similar to be followed for installing any plugin in Eclipse . Try installing other useful plugins for eclipse in the Marketplace.
One word of caution: do not overload your eclipse, with unnecessary plugins. Only install useful plugins and the ones you use regularly for working with files or in your automation.