<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>7.0.0</version> </dependency> import org.testng.annotations.Test; public class MyTestNGTest { @Test public void test1() { } @Test public void test2() { } } mvn test <project> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>my-project</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>7.0.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.2</version> <configuration> <suiteXmlFiles> <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> </plugins> </build> </project> <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" > <suite name="Test Suite" verbose="1"> <test name="My Tests"> <classes> <class name="com.example.MyTestNGTest"/> </classes> </test> </suite>


上一篇:
下一篇:
切换中文