我只使用“http-integration-test”组标记了一个测试类:
@Test(groups = "http-integration-test", timeOut = 60_000)
public class MyIT
然后运行“mvn clean integration-test”。我看到运行了多个测试,而不仅仅是来自这个特定类的测试。
为什么failafe maven插件+ testng组合忽略了只运行“http-integration-test”组的请求?
我的pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>-ea -Xmx256m</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<groups>http-integration-test</groups>
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*IT.java</include>
<include>**/IT*.java</include>
<include>**/TestServerConfigurator.java</include>
<include>*</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
这里是父pom文件部分:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<!-- the default configuration of surefire executes unit
tests implemented using JUnit. please see http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html
for details on these options -->
<configuration>
<!-- -XX:UseSplitVerifier: use legacy class verification; required until javassist can be updated to >= 3.18.2-GA -->
<argLine>-XX:-UseSplitVerifier -XX:MaxPermSize=512m</argLine>
<!-- disable execution of TestNG in case there are both
JUnit and TestNG tests available for execution -->
<testNGArtifactName>none:none</testNGArtifactName>
<excludes>
<!-- Integration Tests end in *IntegrationTest, by
convention -->
<exclude>**/*IntegrationTest.class</exclude>
<exclude>**/*IntegrationTestSuite.class</exclude>
</excludes>
<includes>
<!-- Unit Tests should end in *Test, by convention -->
<include>**/*Test.java</include>
<!-- Include *TestCase, because there are a large
number of tests named this way -->
<include>**/*TestCase.java</include>
</includes>
</configuration>
</plugin>