我在一个配置文件中有两个肯定执行 - 他们需要不同的配置。当我运行 -Dtest=... 时,匹配的测试会运行两次——每次执行一次。
我怎样才能使测试只运行一次?或者更好的是,我怎样才能确保surefire遵循包含和排除?(一次执行将运行 0 个测试;我会使用 -DfailIfNoTest=false。)
<profile>
<id>clustering.integration.tests.profile</id>
<activation>
<property>
<name>clustering.integration.tests</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions combine.children="append">
<!-- Disable default-test execution. -->
<execution>
<id>default-test</id>
<goals><goal>test</goal></goals>
<phase>none</phase>
</execution>
<!-- Single node clustering tests. -->
<execution>
<id>tests-clustering-single-node.surefire</id>
<phase>test</phase>
<goals><goal>test</goal></goals>
<configuration>
<includes>
<include>org/jboss/as/test/clustering/single/**/*TestCase.java</include>
</includes>
</configuration>
</execution>
<!-- Multi node clustering tests. -->
<execution>
<id>tests-clustering-multi-node.surefire</id>
<phase>test</phase>
<goals><goal>test</goal></goals>
<configuration>
<includes>
<include>org/jboss/as/test/clustering/cluster/**/*TestCase.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>