我试图只在mvn的maven中运行集成测试。我在src / it / java中进行Java集成测试,在src / it / groovy中进行Spock集成测试。当我运行mvn failsafe:integration-test时,仅运行src / it / java中的Java集成测试。
这是我的pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-integration-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/it/java</source>
<source>src/it/groovy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<testSourceDirectory>src/it/groovy</testSourceDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6</version>
<configuration>
<testSources>
<testSource>
<directory>src/it/groovy</directory>
<includes>
<include>**/*IT.groovy</include>
</includes>
</testSource>
</testSources>
</configuration>
<executions>
<execution>
<id>groovy-compile</id>
<goals>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
知道我在这里缺少什么吗?
答案 0 :(得分:0)
问题似乎在于您仅在运行failsafe:integration-test。我可以使用以下命令运行groovy和Java测试:
mvn verify
在故障安全文档中,建议在此处使用验证阶段-http://maven.apache.org/surefire/maven-failsafe-plugin/index.html
如果mvn verify仍然无法运行常规测试,请检查your_project / target / test-classes / path_to_your_test中是否有预期的类文件,并确保与pom中的includes选项对齐。