[英]Clover Code Coverage: Instrumenting Unit Tests
I'm using Clover for code coverage and I have the following setup in my pom.xml file. 我使用Clover进行代码覆盖,并且在pom.xml文件中进行了以下设置。
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>4.0.3</version>
<configuration>
<generateHtml>true</generateHtml>
<generateXml>false</generateXml>
<includesTestSourceRoots>false</includesTestSourceRoots>
<includesAllSourceRoots>true</includesAllSourceRoots>
<license>MyLicense</license>
<jdk>1.8</jdk>
<excludes>
<exclude>**/classes/</exclude>
<exclude>**/generated-sources/</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>main</id>
<phase>verify</phase>
<goals>
<goal>instrument</goal>
<goal>check</goal>
<goal>log</goal>
</goals>
</execution>
<execution>
<id>site</id>
<phase>pre-site</phase>
<goals>
<goal>instrument</goal>
<goal>clover</goal>
</goals>
</execution>
</executions>
</plugin>
Then I run Maven the following way: 然后,我通过以下方式运行Maven:
mvn clean install clover2:instrument clover2:instrument-test clover2:aggregate clover2:clover
Though I see code coverage and other details, I see the following warning: 尽管我看到了代码覆盖率和其他详细信息,但是我看到以下警告:
No test results No test results could be found. 没有测试结果找不到测试结果。 Please ensure that you have instrumented your unit tests correctly. 请确保您已正确测试了单元测试。
What does this mean? 这是什么意思? How do I instrument Junit test case classes for Clover? 如何为三叶草检测Junit测试用例类?
I think I found the answer. 我想我找到了答案。 I had to set the following value to "true": 我必须将以下值设置为“ true”:
<includesTestSourceRoots>true</includesTestSourceRoots>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.