gpt4 book ai didi

java - 使用 Maven 插件生成 Cobertura 报告

转载 作者:太空宇宙 更新时间:2023-11-04 14:30:29 28 4
gpt4 key购买 nike

我对代码和 war 文件进行了检测,成功部署到 tomcat 容器中。

我正在对其运行客户端测试。成功运行测试后,当我关闭 tomcat 实例时,tomcat 的 bin 目录中会出现 Cobertura.ser 文件。

Cobertura.ser 文件包含代码覆盖文件的所有详细信息。

现在,我想配置一个 Maven 任务来从 .ser 文件生成 Cobertura html 报告。

我阅读了 Cobertura-maven-plugin 的帮助指南,但无法正确理解。

(我没有运行 junit 测试,但正在执行 selenium 测试)。

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>instrument-code</id>
<phase>package</phase>
<goals>
<goal>instrument</goal>
</goals>
<configuration>
<attach>true</attach>
</configuration>
</execution>
<execution>
<id>generate-report</id>
<phase>prepare-package</phase>
<goals>
<goal>cobertura</goal>
</goals>
<configuration>
<dataFile>C:\Servers\apache-tomcat-8.0.11\bin\cobertura.ser</dataFile>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<outputDirectory>C:\Users\satyam\report</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

这是我的 Cobertura-plugin 的 Maven 配置,但这样 Maven 就不会从位于 tomcat bin 目录中的 Cobertura.ser 文件生成报告。

最佳答案

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<formats>
<format>html</format>
<!-- format>xml</format -->
</formats>
</configuration>
</plugin>

关于java - 使用 Maven 插件生成 Cobertura 报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26228571/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com