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 .
The Eclipse will start installing the plugin when you click on the Finish button.
After install, you would need to restart the Eclipse. You would get an alert to restart the Eclipse at the end of the installation. Click OK and restart your eclipse.
We have done with the installation of TestNG plug-in in eclipse. We may right-click any @Test method class or the TestNG suite file to check the run with the TestNG option.
Right-click any class which has a @Test method in it. You will see the option to run as a 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 the 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.