Maven 故障安全。如何只执行套件文件而不执行独立测试?

Maven failsafe. How to execute only the suite file and not standalone tests?

我有一个子模块 运行 对整个项目进行集成测试,它有几个模块。这是集成测试子模块 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 套件 运行 也是。

我只想 运行 套件文件,我需要这样做,因为套件外的某些测试失败了。 我尝试使用排除选项,但故障保护忽略了该选项。

我该怎么做?

将 pom.xml 更改为

 <configuration>

 <excludes>
            <exclude>**/TestCircle.java</exclude>
            <exclude>**/TestSquare.java</exclude>
          </excludes>
 <suiteXmlFiles>
                                <suiteXmlFile>${project.basedir}/testng/api.xml</suiteXmlFile>
 </suiteXmlFiles>
</configuration>

其中排除项是您不想进行的测试 运行。