Using TestNG with Maven

Maven 2 supports TestNG out of the box without the need to download any additional plugins (other than TestNG itself). It is recommended that you use version 2.4 or above of the Surefire plugin (this is the case in all recent versions of Maven).

You can find the full instructions on the Maven Surefire Plugin website. There are also TestNG-specific instructions.

Specifying your pom.xml

The dependency in your project should look like the following:

For JDK-8 users
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.5.1</version>
    <scope>test</scope>
</dependency>
For JDK-11 users
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.9.0</version>
    <scope>test</scope>
</dependency>

Sample reports