我正在尝试为我的 GWT Maven 项目生成代码覆盖率。
它适用于我的 jUnit 测试
mvn test jacoco:report
但是当我跑步时
mvn gwt:test jacoco:report
生成一个空报告。
运行 gwt:tests 时如何获得代码覆盖率?
Pom.xml
总重量:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<module>${gwtModule}</module>
<gwtVersion>2.5.1</gwtVersion>
<runTarget>https://localhost:8443/dashboard/mainview.jsp</runTarget>
<noServer>true</noServer>
<sourcesOnPath>true</sourcesOnPath>
<hostedWebapp>${war.target}</hostedWebapp>
<mode>HtmlUnit</mode>
</configuration>
<executions>
<execution>
<configuration>
<extraJvmArgs>-Xmx512m</extraJvmArgs>
</configuration>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
雅可可:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.2.201302030002</version>
<configuration>
<destfile>${basedir}/target/coverage-reports/jacoco-unit.exec</destfile>
<datafile>${basedir}/target/coverage-reports/jacoco-unit.exec</datafile>
</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>