CheckOps home

Tools directory

T

CheckOps

TestNG

TestNG is an Apache-2.0 testing framework for Java, inspired by JUnit and NUnit, with annotations, groups, dependencies, data providers, parallel execution and XML suite configuration; it requires Java 11+.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

Introduction

TestNG is a testing framework for the Java platform created by Cédric Beust. It was inspired by JUnit and NUnit but designed from the start to cover more than unit tests: integration, functional and end-to-end suites with groups, dependencies and parallel execution. The “NG” stands for “next generation”.

Its README states that TestNG requires Java 11 or higher and that the library targets Java 11 bytecode, while building from source requires JDK 21. Release notes are published to the testng-users Google group; version 7.12.0 is the latest listed in the README.

TestNG remains especially popular in Selenium and API automation suites. Features such as @DataProvider, test groups, dependsOnMethods and XML suite files make it easy to organise large functional suites, run subsets such as smoke or regression, and parallelise across methods, classes or tests. Many commercial and open-source test frameworks build on it.

How it compares: JUnit 5 (Jupiter) closed much of the original feature gap with tags, parameterised tests, dynamic tests and parallel execution, and it is now the default in most new Java projects and in tools such as Spring Boot’s starters. TestNG’s strengths are its long-standing support for test dependencies, flexible suite XML and data providers, which many automation teams still prefer. Both run in Maven Surefire, Gradle and all major IDEs, so the choice usually comes down to team habits and existing suites.

In the quality loop, TestNG spans unit, integration and functional stages, and it is common in UI and API automation frameworks that need fine-grained control over which tests run where.

The source code is at testng-team/testng on GitHub under the Apache-2.0 licence, with about 2,100 stars; the most recent commit was on 11 November 2026.

Reporting is a practical strength. TestNG writes its own HTML and XML reports out of the box, and its listener interfaces are the integration point for Allure, ReportPortal, Extent Reports and similar tools. Retry logic can be added with IRetryAnalyzer, which many UI suites use to separate genuinely flaky infrastructure failures from real defects, although retries should be monitored so they do not hide problems. Parameters from testng.xml or system properties make it simple to run the same suite against different browsers, environments or devices, which is why TestNG appears so often in cross-browser and mobile automation frameworks.

Features

  1. Annotations: @Test, @BeforeMethod, @AfterClass, @BeforeSuite and more give precise control over setup and teardown at every level.
  2. Data providers: @DataProvider feeds many rows of data into a single test method, including lazily generated data.
  3. Groups: Tag tests into groups such as smoke or regression and include or exclude them at run time.
  4. Dependencies: dependsOnMethods and dependsOnGroups skip tests whose prerequisites failed, which keeps reports readable.
  5. Parallel execution: Run methods, classes, tests or instances in parallel with configurable thread counts.
  6. Suite XML: testng.xml files define suites, parameters, listeners and parallel settings in one place.
  7. Listeners and reporters: Hooks such as ITestListener and IReporter power custom reports and integrations like Allure and ReportPortal.
  8. Factories: @Factory creates test instances dynamically for data-driven classes.

Pros

  1. Great for automation suites: Groups, dependencies and parallelism suit large Selenium and API suites.
  2. Mature ecosystem: Supported by Maven, Gradle, IntelliJ IDEA, Eclipse and most reporting tools.
  3. Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
  4. Actively maintained: The repository had commits as recent as 11 November 2026.

Cons

  1. Less default momentum: Most new Java projects and frameworks default to JUnit 5.
  2. XML configuration: Suite XML can grow large and hard to maintain.
  3. Test dependencies can hide problems: Heavy use of dependsOnMethods couples tests and makes them harder to run in isolation.
  4. Java 11+ requirement: Very old projects on Java 8 must stay on older TestNG versions.

Add TestNG to a Maven project:

<dependency>
  <groupId>org.testng</groupId>
  <artifactId>testng</artifactId>
  <version>7.12.0</version>
  <scope>test</scope>
</dependency>

A data-driven test with groups:

import org.testng.annotations.*;
import static org.testng.Assert.assertEquals;

public class PriceTest {
  @DataProvider(name = "prices")
  public Object[][] prices() {
    return new Object[][] { {100, 10, 90}, {50, 0, 50} };
  }

  @Test(dataProvider = "prices", groups = "smoke")
  public void appliesDiscount(int price, int discount, int expected) {
    assertEquals(Pricing.apply(price, discount), expected);
  }
}

A suite file that runs only smoke tests in parallel:

<suite name="smoke" parallel="methods" thread-count="4">
  <test name="smoke">
    <groups><run><include name="smoke"/></run></groups>
    <packages><package name="com.example.*"/></packages>
  </test>
</suite>

Practical tips:

  1. Use groups rather than separate projects to split smoke, regression and slow suites.
  2. Keep dependsOnMethods for genuine prerequisites only, so most tests stay independent.
  3. Add a listener-based reporter such as Allure for readable CI reports.

Resources:

Pricing

TestNG is free and open source under the Apache-2.0 licence.

  1. Test automation engineers building Selenium, Appium or REST Assured suites.
  2. Teams with existing TestNG suites that rely on groups, dependencies and XML suites.
  3. Projects needing data-driven tests with flexible data providers.
  4. Not a fit if you want the default choice for a brand-new Java codebase; JUnit 5 is more common there.

Conclusion

TestNG is a mature, powerful Java testing framework whose groups, dependencies, data providers and suite files still make it a favourite for automation suites.

JUnit 5 is the more common default for new unit tests, but TestNG remains a solid, actively maintained choice, especially for functional and end-to-end automation in Java.

Compare

CheckOps pages that put TestNG next to related tools. There is no paid placement on these lists.

Alternatives

Other tools on CheckOps that cover similar ground. Open a page, or compare one with TestNG side by side.