How to Install TestNG in Eclipse Online and Offline Method

In this tutorial, I will show you how to install TestNG in Eclipse in multiple ways. TestNG is a testing framework designed for the Java programming language. The framework is inspired by JUnit and NUnit. It is a cutting edge test automation tool that overcomes the limitation in the JUnit framework. In its initial era, it was only used in unit testing of the Java projects during the development phase.

However, nowadays it has become very popular amongst the testing fraternity because of its rich feature. TestNG plays an instrumental role in the test script development as well as test suite creation and execution. Some of its cool features are TestNG annotations, test case management, parallel execution, effective reporting, and much more.

So let’s explore how to install TestNG in Eclipse in three different ways. To install TestNG in Eclipse, please follow the instructions below.

Install TestNG Using Eclipse Marketplace

Step 1: Launch the Eclipse IDE and go to the Help > Eclipse Marketplace.

TestNG Eclipse Marketplace

Step 2: A new window would come up, here you need to type “TestNG” in the Find search box and hit Enter Key or click on the Go button.

TestNG Eclipse Marketplace Selenium 2

Step 3: The search results will now show TestNG for Eclipse at the top. You only need to click the Install button next to it.

Install TestNG for Eclipse Java

Step 4: Eclipse may take some time to resolve features, after which you must verify that the TestNG checkbox is checked and click the Confirm button to continue.

Install TestNG with Eclipse Selenium

Step 5: Review Licenses window may open up. Accept the license and click on the Finish button.

Install TestNG with Eclipse Agreement

Eclipse will start installing TestNG that might take few minutes. You can see the progress at the right bottom of Eclipse.

TestNG Installation progress

A warning message may appear when the installation is complete. Click on the Install anyway button.

TestNG Installation Warning Message

Eclipse will ask you to restart Eclipse to apply the software update. Click on the Restart Now button.

TestNG Installation Restart Message

Step 6: After restarting Eclipse, you can check if TestNG is installed by right-clicking on your project and looking for TestNG in the opened menu option.

TestNG Installation Verification in Java Project

Also, see Configure Selenium Webdriver With Eclipse

Install TestNG Using Install New Software Option

If the TestNG Plugin is not available in the Eclipse Marketplace, you don’t need do get disappointed. You can try this option.

Steps to Install TestNG in Eclipse as new software

Step 1: Launch the Eclipse IDE and go to the Help > Install New Software.

TestNG Installation in Eclipse New Software Add

Step 2: The following dialog box will be displayed, click on the “Add” button.

TestNG Installation in Eclipse New Software Add Path

Step 3: In the Add Repository dialog box, provide any name, let’s name it as “TestNG” and in the location field type “https://testng.org/testng-eclipse-update-site/” and click on the Add button.

TestNG Installation in Eclipse New Software

Step 4: Eclipse will start looking for the TestNG plugin and might take a few seconds. Once it can find TestNG it will be displayed in the Software list. Select the checkbox against TestNG and click on the Next Button.

TestNG Installation in Eclipse New Software-2

Step 5: You might see the following dialog box. Select TestNG and click on the “Next” button.

TestNG Installation in Eclipse New Software Select TestNG Option

Step 6: Select the “I accept the terms of the license agreement” and click on the Finish button.

Install TestNG with Eclipse Agreement

Step 7: You may see a Security Warning dialog box, in that case, click on the “Install anyway” button.

TestNG Installation Warning Message

Step 8: The installation is now complete. Click on the “Restart Now” button.

TestNG Installation Restart Message

Step 9: After the restart, you can verify whether TestNG was installed successfully. Do a right-click on your project and see if TestNG is displayed in the opened menu option.

TestNG Installation Verification in Java Project

Now you are good to go and start executing your tests using TestNG. To kick start with Selenium WebDriver Automation please refer to my post, Configure Selenium Webdriver With Eclipse

TestNG Offline Installation Using Local Library File

If you are unable to install TestNG using any of the accessible online methods, try the offline method. So, let’s see the quickest and most straightforward technique to install TestNG offline.

Step 1: Download the desired version of TestNG zipped file from https://github.com/cbeust/testng-eclipse.You’ll find download links under the TestNG for Eclipse Plugin section. After downloading it extract the files to any directory. I have extracted the files at the below path on my machine. You will see two directories at this location with names features and plugins. We will these directories to install TestNG.

TestNG Jar Files

Step 2: Go to Eclipse installation folder > dropins. Inside dropins folder create a new folder name it as testng-eclipse-7.4.0. Name it according to the version of TestNG har files you have downloaded. At the time of writing this post, the latest release version was “7.4.0.202106051955”.

TestNG Jar Files Manual Installation

Step 3: Now copy the features and plugins directories extracted from the TestNG zip file to this Eclipse “dropins” folder.

TestNG Jar Files Manual Installation in Eclipse

Step 4: Now launch Eclipse IDE and check if TestNG is installed by right-clicking on your project and looking for TestNG in the opened menu option.

TestNG Installation Verification in Java Project

Recommended Posts

Leave a Reply