我的目录结构如下:
src/integrationTest/javasrc/test/javasrc/main/java我试图通过故障保护来进行集成测试,但是没有按照我想要的方式进行。
我已经试过了:
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<testSourceDirectory>src/integrationTest/java</testSourceDirectory>
<testClassesDirectory>${project.build.directory}/it-classes</testClassesDirectory>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
和这个:
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>src/integrationTest/**/*.java</include>
</includes>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
无济于事 故障安全找不到运行的测试。
我已经能够使用build-helper-maven插件添加一个test-source目录,然后使用failsafe运行测试。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-integration-test-source-as-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/integrationTest/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是,现在的问题是,surefire现在也将测试作为单元测试运行。当故障保险应该能够找到测试时,似乎也不必使用其他插件。我不希望不需要使用build-helper maven插件并配置surefire来排除该路径。
我究竟做错了什么?