1、项目的pom.xml要配置插件,同时指定testng.xml文件的位置。就被这个卡了好久
<properties> <maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version> <suiteXmlFile>src/test/testng.xml</suiteXmlFile> </properties> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.9.10</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven-surefire-plugin.version}</version> <configuration> <suiteXmlFiles> <suiteXmlFile>${suiteXmlFile}</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> </plugins> </build>
2、Jenkins job配置相对简单