TestNG, as the name suggest, is the next generation test automation tool that fills the gaps in the JUnit framework. The basic idea behind the inception of these tools was to cut down the unit testing efforts during the Java development. However, these tools are now being utilized by the software testers for test-driven development. Since TestNG is the new entrant, it brings a list of cool features like TestNG annotations, parallel execution, test case management, effective reporting and much more. Interestingly, there is a TestNG plugin that we can integrate with the Eclipse IDE and instantly start creating TestNG projects in Eclipse. In this post, we’ll train you on how to install TestNG in Eclipse. And we’ll showcase the three unique ways for installing the TestNG plugin in Eclipse IDE.
Just to talk a little about the TestNG features such as annotations, they are like the small hooks yet so powerful where you can put instructions to control the flow of a test case, a group of test cases or the whole test suite. Next is the intelligent reporting which comes up with the following key benefits.
- Tracking of the application performance,
- Enhance debugging,
- Quick identification of the defects,
- Aging and the historical comparison of the data.
We’ve stated earlier that we’ll present you the three ways to install TestNG in Eclipse IDE. Let’s now get through each of the methods one by one.
- Install TestNG in Eclipse directly from the Eclipse Marketplace.
- Installing TestNG Plugin in Eclipse using the “Install New Software…” feature.
- Install TestNG in Eclipse IDE via offline Jar files.
Before you move to the next section, please make sure you have got the right version of Eclipse software installed.
In case, you are uncertain or don’t have the software then use the below link to download Eclipse.➡ Download Eclipse IDE
How to Install TestNG in Eclipse IDE?
All the new Eclipse IDE versions are now coming up with the Eclipse marketplace plugin. It’s the most easier and quicker way to install any third party plugin in Eclipse including the TestNG plugin. Eclipse Marketplace gives you a rich interface to search and install the plugins.
You can access this plugin from the help menu available on the main toolbar. Click on the “Eclipse Marketplace…” option listed under the help menu.
In the “Find” input field, write “TestNG” and press enter to search. The search will land you the desired TestNG plugin listed in the result section. There you’ll see an “Install” button with every result that appears in the search. Press it to continue installing the TestNG for Eclipse.
You might think that when it’s so easy to install TestNG then what is the use of mentioning the old and lengthy ways to achieve the same. We are listing the legacy TestNG installation methods because there are people who still use the old Eclipse versions. Additionally, there are IT companies who works in the restricted network environment where an automatic TestNG installation is not possible.
Open the Eclipse IDE, from the main menu bar, select the Help menu and click on the “Install New Software…” option. It’ll launch an install popup window.
Fill the BEUST site link (http://beust.com/eclipse) in the work field and click the Add button.
Add button action will open a small popup dialog asking for the name of a repository. Assign the value “TestNG” in the name field and press the OK button.
After pressing the OK button, Eclipse will query the above link and list the available version of the TestNG plugin.
Now tick on the “TestNG” item displayed in the list and click on the “Next” button present at the bottom of the popup window.
Soon after pressing the “Next” button, the plugin manager will check for the required components and dependencies.
If it detects any such requirement, you’ll need to install it first before going with the TestNG installation. Though, you are unlikely to see any error/warning as in most of the cases it completes the TestNG installation without any issue.
Next, in the sequence, you’ll see a license agreement dialog, just click on the “accept…” radio button. Then click on “Finish” to complete the TestNG installation process.
In this step, you’ll see a security warning which you ignore by clicking the OK button. After this Eclipse will restart to complete the TestNG installation process.
Firstly download the latest TestNG Jar files from the link given below. We’ve provided the direct URL to download the TestNG version 6.11.➡ Download TestNG 6.11
Clicking on the link will download the “site_assembly.zip” file for the TestNG version 6.11. This file contains two folders named as “features” and “plugins“.
The features folder contains the following two files.
The plugins folder contains these two files.
Note – You can check for more recent releases of TestNG from here.
- Go to the eclipse installation directory and look for the “dropins” folder there.
- Create a folder inside the dropins folder and name it as “testng-eclipse-6.11“.
- 6->Major version & 11->Minor version of the TestNG plugin.
- Extract the “site_assembly.zip” file and copy its content i.e. the “features” and “plugins” folders to the newly created “testng-eclipse-6.11” directory.
The eclipse install directory would now look like this.
C:\Users\techbeamers\eclipse jee-neon\ dropins\ testng-eclipse-6.11\ features\ org.testng.eclipse.maven.feature_22.214.171.124703011520.jar org.testng.eclipse_126.96.36.199703011520.jar plugins\ org.testng.eclipse.maven_188.8.131.52703011520.jar org.testng.eclipse_184.108.40.206703011520.jar
Note – We’ve tested this option with the Eclipse Neon version.
Last but not the least, you will need to restart or start the Eclipse to see the TestNG plugin getting loaded into the IDE. However, the process would be slightly slow as the Eclipse will first time load the new plugin.
From Eclipse, by pressing CTRL+N, you can open the “New” wizard. It will load the list of all available module/project templates. By scrolling down in the list, you can make sure that it has the “TestNG” option.
Summary – Three Ways to Install TestNG.
So that was all about the different methods to install TestNG in Eclipse IDE. Writing this post would be worthful if it could help you with TestNG installation.
In our future posts, we’ll cover more about the TestNG, its features, and integration with Selenium WebDriver for web UI test automation.