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+.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
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
- Annotations:
@Test,@BeforeMethod,@AfterClass,@BeforeSuiteand more give precise control over setup and teardown at every level. - Data providers:
@DataProviderfeeds many rows of data into a single test method, including lazily generated data. - Groups: Tag tests into groups such as
smokeorregressionand include or exclude them at run time. - Dependencies:
dependsOnMethodsanddependsOnGroupsskip tests whose prerequisites failed, which keeps reports readable. - Parallel execution: Run methods, classes, tests or instances in parallel with configurable thread counts.
- Suite XML:
testng.xmlfiles define suites, parameters, listeners and parallel settings in one place. - Listeners and reporters: Hooks such as
ITestListenerandIReporterpower custom reports and integrations like Allure and ReportPortal. - Factories:
@Factorycreates test instances dynamically for data-driven classes.
Pros
- Great for automation suites: Groups, dependencies and parallelism suit large Selenium and API suites.
- Mature ecosystem: Supported by Maven, Gradle, IntelliJ IDEA, Eclipse and most reporting tools.
- Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 11 November 2026.
Cons
- Less default momentum: Most new Java projects and frameworks default to JUnit 5.
- XML configuration: Suite XML can grow large and hard to maintain.
- Test dependencies can hide problems: Heavy use of
dependsOnMethodscouples tests and makes them harder to run in isolation. - Java 11+ requirement: Very old projects on Java 8 must stay on older TestNG versions.
Usage and Links (Example)
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:
- Use groups rather than separate projects to split smoke, regression and slow suites.
- Keep
dependsOnMethodsfor genuine prerequisites only, so most tests stay independent. - 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.
Recommended for?
- Test automation engineers building Selenium, Appium or REST Assured suites.
- Teams with existing TestNG suites that rely on groups, dependencies and XML suites.
- Projects needing data-driven tests with flexible data providers.
- 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.
Roundups
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with TestNG side by side.
JJUnit 5JUnit 5 is the current JUnit for Java and the JVM: Jupiter for new tests, Platform to launch them, Vintage to run JUnit 4.Compare with TestNG
SSpock FrameworkSpock is an Apache-2.0 BDD-style testing and specification framework for Java and Groovy applications, with given/when/then blocks, powerful data-driven tests and built-in mocking, running on the JUnit Platform.Compare with TestNG
KKotestKotest is an Apache-2.0 Kotlin multiplatform test framework with multiple testing styles, a large assertions library and built-in property-based testing.Compare with TestNG
SSeleniumA browser automation framework and ecosystem.Compare with TestNG
RRest-AssuredJava DSL for easy testing of REST services.Compare with TestNG
AAssertJAssertJ is an Apache-2.0 fluent assertions library for Java, with rich, discoverable assertions for core types, collections, exceptions, dates and more, plus soft assertions and custom assertion generation.Compare with TestNG