我正在尝试使用 Cobertura 检测 groovy 脚本,但似乎 Cobertura 只能检测 groovy 类。我可以在报告中看到脚本,但它总是以 0% 的覆盖率显示它们。我正在使用 GroovyShell 执行测试中的脚本。似乎由于脚本的执行方式,Cobertura 无法将源代码与测试匹配。
这是我的 Cobertura 配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
<check/>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>