2015-11-06 146 views
0

我使用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> 

然后我运行Maven方式如下:

mvn clean install clover2:instrument clover2:instrument-test clover2:aggregate clover2:clover 

虽然我看到的代码覆盖率等细节,我看到以下警告:

没有测试结果 没有测试结果可能被发现。请确保您已正确安装了您的单元测试。

这是什么意思?我如何测试Clover的Junit测试用例类?

回答

0

我想我找到了答案。 我必须将以下值设置为“true”:

<includesTestSourceRoots>true</includesTestSourceRoots>