【问题标题】:Cobertura-report generation with maven plugin使用 maven 插件生成 Cobertura 报告
【发布时间】:2014-12-01 10:35:20
【问题描述】:

我已成功部署到 tomcat 容器中的代码和 war 文件的检测。

我正在运行我的客户端测试。成功运行测试后,当我关闭我的 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 文件生成报告。

【问题讨论】:

    标签: java code-coverage cobertura maven-cobertura-plugin


    【解决方案1】:
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <configuration>
     <formats>
       <format>html</format>
       <!-- format>xml</format -->
     </formats>
     </configuration>
     </plugin>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-10
      • 1970-01-01
      • 2011-03-02
      • 2012-03-13
      • 1970-01-01
      • 2013-04-27
      • 2010-10-10
      • 2017-02-05
      相关资源
      最近更新 更多