Selenium-TestNG Integration: Overview & Features of TestNG

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. It is designed to cover all categories of tests − unit, functional, end-to-end, integration, etc., and it requires JDK 5 or higher. Automation Testers make use of TestNg to execute our tests. And it also provides some cool features in the form of parameters of annotations.
Features of TestNG:
  • Annotations (@BeforeMethod, @Test, @@AfterMethod etc.)
  • Flexible test configuration
  • Support for data-driven testing (with @DataProvider)
  • Support for annotation parameters
    • DependsOnMethods
    • Priority
  • Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...).
  • Default JDK functions for runtime and logging (no dependencies)

What is an Annotation?
  • 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. 
  • Please find the coding example below:
import org.testng.annotations.Test;

public class TestngPriority {
  @Test(priority=0) // <<<<==== This is a TestNG annotation
  public void one() {
   System.out.println("This is test case 1");

TestNG Components:
  1. Annotations 
  2. Annotation Parameters
  3. Verify and Assert
  4. Page Factory
  5. Data Provider
  6. Creating suite using testng.xml

    << Previous    ||    Next >>  Install TestNG in Eclipse

    Join Telegram channel of this blog at
    Feel free to ask queries or share your thoughts in comments or email me.


    Post a Comment

    Popular Posts

    Top 10 Demo Websites to Practice Selenium Webdriver Online

    How To Handle Dynamic Xpaths (Web Table) in Selenium WebDriver

    How to Take Screenshot and Partial Screenshot in Selenium WebDriver

    Selenium WebDriver - Browser and Navigation Commands

    Automation Framework Building 1st step - Implementing Code Re-usablility