2017-02-10 72 views
0

war文件位于tomcat7/webapps /中。我曾在pom.xml以下变化:我们可以使用Jacoco测量手动测试的代码覆盖率吗?

<plugin> 
    <groupId>org.jacoco</groupId> 
    <artifactId>jacoco-maven-plugin</artifactId> 
    <version>0.5.5.201112152213</version> 
    <configuration> 
      <destFile>${basedir}/../../../../../../opt/tomcat7/webapps/coverage-reports/jacoco-unit.exec</destFile> 
      <dataFile>${basedir}/../../../../../../opt/tomcat7/webapps/coverage-reports/jacoco-unit.exec</dataFile> 
      <outputDirectory>${basedir}/../../../../../../opt/tomcat7/webapps/coverage-reports/jacoco</outputDirectory>                         </configuration> 
      <executions> 
        <execution> 
          <id>jacoco-initialize</id> 
          <goals> 
            <goal>prepare-agent</goal> 
          </goals> 
        </execution> 
        <execution> 
          <id>jacoco-site</id> 
          <phase>package</phase> 
          <goals> 
            <goal>report</goal> 
          </goals> 
        </execution> 
      </executions> 
     </plugin> 
    </plugins> 

建设上述项目后,文件夹获取tomcat7创建/ webapps中包含的index.html。但同样的情况继续给出0%的覆盖率报告。有什么我做错了吗?

回答

0

prepare-agent文档:

准备指向可以作​​为VM参数测试的应用程序被传递的JaCoCo运行剂的性质。

所以最好的猜测是你忘记使用这个属性来执行Tomcat的JVM。

相关问题