我有一个子模块,它运行整个项目的集成测试,它有几个模块。这是集成测试子模块pom:
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sample.server</groupId>
<artifactId>jacoco-test</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.sample.server.modules</groupId>
<artifactId>integration_test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>integration_test</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
</dependency>
<dependency>
<groupId>com.sample.server.modules</groupId>
<artifactId>api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${project.basedir}/testng/api.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
</executions>
</plugin>
</project>
当我执行mvn install或verify时,然后运行所有独立测试,之后运行xml套件。
我只想运行套件文件,我需要这样做,因为某些测试在套件外部失败。 我尝试使用exclude选项,但failsafe忽略了该选项。
我该怎么做?
答案 0 :(得分:0)
将pom.xml更改为
<configuration>
<excludes>
<exclude>**/TestCircle.java</exclude>
<exclude>**/TestSquare.java</exclude>
</excludes>
<suiteXmlFiles>
<suiteXmlFile>${project.basedir}/testng/api.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
其中排除项是您不想运行的测试。