Setup TestNG in eclipse for automating test using Selenium Webdriver and Java

TestNG is a testing framework developed in the lines of JUnit and NUnit, however it introduces some new functionalities that make it more powerful and easier to use.
TestNG is designed to cover all categories of tests − unit, functional, end-to-end, integration, etc., and it requires JDK 5 or higher. Some of its features are listed down:
  • Annotations.
  • Flexible test configuration.
  • Support for data-driven testing (with @DataProvider).
  • Support for parameters.
  • Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...).
  • Default JDK functions for runtime and logging (no dependencies).
  • Dependent methods for application server testing.
Annotation in TestNG actually is code snippet which lies just ahead of the method declaration and controls the execution of the method. Annotation starts with @ sign. Below is the example of it:

Install TestNG in Eclipse:

You need to install TestNG plugin in your Eclipse to work with it. Below are the steps:
  1. Open Eclipse.
  2. Click on the 'Help' menu option.
  3. Click on "Eclipse Marketplace"

4. Type Testng in Find text box and click on search icon. After TestNG is appeared in the search click on the Install button.

5. After clicking Install, it will show some other dialogues, just click accept the terms and click Finish.
6. Installation will take some time to complete.
7. Eclipse will ask you for restart, click yes.
8. After restart, you can verify if TestNG is installed correctly or not. Click Window -> Preferences , TestNG should display in Preferences list.

That's it, you are done with the installation. We will creating and executing test cases using TestNG in next post. 

Feel free to share your thoughts. Happy Coding :)

@uthor -  Vaneesh Behl


Post a Comment

Popular posts from this blog

Top 6 Demo Websites For Practice Selenium Webdriver

A Guide To All Selenium Webdriver Commands

Selenium Essentials - Become Expert in Selenium Webdriver Automation with JAVA