CS/IT Turotials

How to Install TestNG in Eclipse for Selenium Webdriver

Google+ Pinterest LinkedIn Tumblr

While going through the series of Selenium WebDriver tutorials, we are introducing in this tutorial about TestNG and the different methods to install TestNG in Eclipse for Selenium WebDriver. Before going to the installation process, let’s begin with what the TestNG is and why to use TestNG with Selenium WebDriver.

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.

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.

  1. 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.
  2. Since, it supports using annotations(@), we can easily manage the test scripts and able to set the priority for running the test cases.
  3. It introduces the test groups, so we can group multiple test cases by converting them into testing.xml file.
  4. 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 image below.

Click on "Install New Software"

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.

Enter location of the site

Step3: When searching for the available software finished, give the check mark on “TestNG” and then click on next button.

Selecting the available software

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 security warning message. Click on “OK” to continue the installation.

Security warning

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 much easy method of installing TestNG on Eclipse than the previous method. Use the following steps in order to install TestNG in Eclipse from Eclipse Marketplace.

Step1: Go to the TestNG page on Eclipse Marketplace.

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.

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

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.

Showing Eclipse Marketplace

Step3: When you have dropped the button, it will show the features that are going to be installed. Click on the confirm button to confirm the selected features and continue the installation as given below.

confirm selected features

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.

Accept the terms of the license agreement

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

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 7 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Write A Comment