Usually you donβt need anything special with TestNG. Just use the maven-surefire plugin:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12</version> </plugin>
and based on this, all tests must be performed that must be properly annotated. Ah, of course, you need a dependency on TestNG as follows:
<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.5.2</version> <scope>test</scope> </dependency>
As a rule, I will no longer create test objects, because this is what you need to support, which is often skipped for updates, etc. Just use annotations.
If you need to run a specific test suite, simply define the testng.xml file in src / test / resources and upgrade the maven-surefire plugin accordingly.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12</version> <configuration> <suiteXmlFiles> <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin>
source share