TestNG is an open source automation testing framework which was inspired by JUnit that uses annotations for managing test cases more efficiently. In TestNG, “NG” means Next Generation, so it was the testing framework built for the next generation that eliminates most of the limitations of the older testing frameworks like JUnit and NUnit. TestNG allows the testers to write more powerful and flexible tests than other testing frameworks.
Table of Contents
Why Use TestNG With Selenium WebDriver
Since, selenium WebDriver have some limitations for generating test results, managing and running the test. Using TestNG with selenium WebDriver can overcome all the limitations of using default selenium. Following are the most important features and advantages of using TestNG with selenium.
- It can generate the test report in a proper format that includes all the details on how many number of test cases are passed, failed and skipped after executing the test script.
- Since, it supports using annotations(@), we can easily manage the test scripts and able to set the priority for running the test cases.
- It introduces the test groups, so we can group multiple test cases by converting them into testing.xml file.
- Due to its flexible run-time configuration feature, we can execute test cases multiple times without using loops.
How to Install TestNG in Eclipse IDE
There are two methods of installing TestNG in Eclipse for selenium WebDriver, one is installing TestNG from update site using “Install New Software” option available on the help menu and another method is installing from Eclipse Marketplace. Following are the step by step guide for installing TestNG in Eclipse IDE using different methods.
1. Install TestNG from Update Site
Use the following steps to download and install TestNG in Eclipse from the update site.
Step1: Open Eclipse IDE. Go to help menu and click on the option “Install new software” as shown on the
Step2: On the new window, click on “Add” button. Give the name i.e. “TestNG” and place “http://beust.com/eclipse” on the location field, then click on “Add” button.
Step3: When searching for the available software finished, give the check mark on “TestNG” and then click on next button.
Step4: On the next window, it will ask to accept the terms of license agreement. So click on “I accept the terms of the license agreement” and then click on the Finish button.
Step5: On the process of installing the plugin, it may give the
Step6: When the installation completed, it will ask to restart the application. Click on “Yes” to restart the Eclipse IDE.
2. Install TestNG from Eclipse Marketplace
It was a
Step1: Go to the TestNG page on Eclipse Marketplace.
Step2: Drag the “Install” button provided on the Eclipse Marketplace page and drop to the running Eclipse workspace. I have also added an external install button below that is provided by Eclipse Marketplace. You can directly drag and drop install given below.
It should require “Eclipse Marketplace Client” installed on the Eclipse IDE. To verify whether the “Eclipse Marketplace Client” installed on IDE, go to help menu and observe whether “Eclipse Marketplace” link available as shown on the image below.
Step3: When you have dropped the button, it will show the features that are going to be installed. Click on the
Step4: On the next window, it will ask to accept the terms of license agreement. So click on “I accept the terms of the license agreement” and then click on the Finish button.
Step5: Click on “OK” to continue the installation when security warning message displayed. When installation finishes, Click on “Yes” to restart the Eclipse IDE.
Read Next: How to Create the First Test Case With TestNG in Eclipse