What is 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.
Feature 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

    Follow Us

    Quora Space | Facebook Page | Telegram Channel
    Feel free to ask queries or share your thoughts in comments or email us.


    Post a Comment

    Popular posts from this blog

    10 Best Demo Websites for Automation Testing Practice

    Automate 'User Registration' of E-commerce Website using Selenium

    Automate Browser Actions on Godaddy.com using Selenium

    Automate E-Commerce Website using Selenium Webdriver