dev*_*snd 22 junit jar surefire maven
我的maven存储库中有一个包含junit测试的jar,它应该在不同的项目中运行,因为它能够检查项目并测试它的某些功能.不幸的是,正如此功能请求所示,surefire不会接收jar中包含的测试.
在功能请求中,他们建议解压缩jar然后由surefire执行.
我使用maven-dependency-plugin成功解压缩了jar,但无论如何都没有执行包含的测试.这就是我如何配置maven-dependency-plugin以解压我的jar:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>de.mwx.test</groupId>
<artifactId>selenium-test-base</artifactId>
<version>0.1</version>
<overWrite>true</overWrite>
<outputDirectory>
${project.build.directory}/classes
</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
任何帮助都会得到满足.
gal*_*ben 36
有一种从另一个jar在maven中运行测试的新方法.从maven-surefire-plugin 2.15版开始,你可以告诉maven扫描你的测试罐进行测试并运行它们.您不需要提取测试jar.只需在测试jar中添加依赖项即可:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<dependenciesToScan>
<dependency>test.jar.group:test.jar.artifact.id</dependency>
</dependenciesToScan>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
从https://gist.github.com/aslakknutsen/4520226 和https://issues.apache.org/jira/browse/SUREFIRE-569获取这些东西
归档时间: |
|
查看次数: |
14601 次 |
最近记录: |