我使用surefire和failsafe分别执行单元测试,集成测试。所有测试都位于文件夹src/test/java
中。到目前为止,我有一个集成测试类TaskAdditionIT.java
,其测试方法(使用@Test注释)在运行所有单元测试时永远不会执行。这是我的pom.xml的摘录:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</configuration>
</plugin>
我使用maven目标verify
来运行测试。
答案 0 :(得分:0)
解决方案:
不要将executions
嵌入configuration
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>