【问题标题】:Jacoco IT report created, but no htmlJacoco IT 报告已创建,但没有 html
【发布时间】:2015-03-17 02:53:29
【问题描述】:

我有一个多模块 java maven 项目,其中一个模块包含集成测试。我使用了 jacoco-maven-plugin 并在该模块中成功生成了 jacoco-it.exec。但由于某种原因,没有创建 html 报告。声纳也不会读取此报告。

它适用于单元测试,但不适用于集成测试。

这是我添加到 pom.xml 中的内容:

    <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.7.1.201405082137</version>
        <executions>
            <execution>
                <id>default-prepare-agent</id>
                <goals>
                    <goal>prepare-agent</goal>
                </goals>
            </execution>
            <execution>
                <id>default-report</id>
                <phase>prepare-package</phase>
                <goals>
                    <goal>report</goal>
                </goals>
            </execution>
            <execution>
                <id>default-check</id>
                <goals>
                    <goal>check</goal>
                </goals>
                <configuration>
                    <rules>
                        <rule implementation="org.jacoco.maven.RuleConfiguration">
                            <element>BUNDLE</element>
                            <limits>
                                <limit implementation="org.jacoco.report.check.Limit">
                                    <counter>COMPLEXITY</counter>
                                    <value>COVEREDRATIO</value>
                                    <minimum>0.1</minimum>
                                </limit>
                            </limits>
                        </rule>
                    </rules>
                </configuration>
            </execution>
            <execution>
                <id>default-prepare-agent-integration</id>
                <phase>pre-integration-test</phase>
                <configuration>
                    <destFile>target/jacoco-it.exec</destFile>
                    <propertyName>failsafe.argLine</propertyName>
                </configuration>
                <goals>
                    <goal>prepare-agent-integration</goal>
                </goals>
            </execution>
            <execution>
                <id>default-report-integration</id>
                <phase>post-integration-test</phase>
                <goals>
                    <goal>report-integration</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.16</version>
        <configuration>
            <argLine>${failsafe.argLine}</argLine>
        </configuration>
        <executions>
            <execution>
                <id>default-integration-test</id>
                <goals>
                    <goal>integration-test</goal>
                </goals>
            </execution>
            <execution>
                <id>verify</id>
                <goals>
                    <goal>verify</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

【问题讨论】:

    标签: java maven jacoco


    【解决方案1】:

    要获得集成测试的 HTML 报告,您必须使用 maven-failsafe-report-plugin。但我相信这显示了所有测试的报告,包括单元和集成

    http://maven.apache.org/surefire/maven-surefire-report-plugin/

    【讨论】:

      猜你喜欢
      • 2017-06-16
      • 2021-06-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-16
      • 2020-02-16
      • 2015-10-18
      • 1970-01-01
      • 2014-09-24
      相关资源
      最近更新 更多