2017-02-10 114 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。

相關問題