具有故障保护和jacoco的集成测试报告显示0%的覆盖率

时间:2016-11-14 07:12:02

标签: integration-testing maven-failsafe-plugin jacoco-maven-plugin

目标:使用failsafe和jacoco,这两个插件来创建集成测试报告。 问题:预期的报告已创建,但它显示覆盖率为0%。 report html

这里是关于jacoco的pom.xml中的代码。

 <plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.8-SNAPSHOT</version>
    <executions>
        <execution>
            <!--prepare-agent -->
        </execution>
        <execution>
            <!--report -->
        </execution>
        <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>prepare-agent-integration</goal>
            </goals>
            <configuration>
                <!-- Sets the path to the file which contains the execution data. -->
                <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
                <!-- Sets the name of the property containing the settings for JaCoCo 
                    runtime agent. -->
                <propertyName>failsafeArgLine</propertyName>
            </configuration>
        </execution>
        <execution>
            <id>post-integration-test</id>
            <phase>integration-test</phase>
            <goals>
                <goal>report-integration</goal>
            </goals>
            <configuration>
                <!-- Sets the path to the file which contains the execution data. -->
                <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
                <!-- Sets the output directory for the code coverage report. -->
                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
            </configuration>
        </execution>
        <execution>
            <!--check -->
        </execution>

    </executions>
</plugin>    

这是关于故障保护的代码。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.16</version>
    <executions>
        <execution>
            <id>execute-local-integration-tests</id>
            <phase>integration-test</phase>
            <goals>
                <goal>integration-test</goal>
            </goals>
            <configuration>
                <systemPropertyVariables>
                    <integration.test.server.url>http://${local.server.host}:${local.server.http.port}</integration.test.server.url>
                </systemPropertyVariables>
            </configuration>
        </execution>
        <execution>
            <id>verify-local-integration-tests</id>
            <goals>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <!-- Sets the VM argument line used when integration tests are run. -->
        <argLine>${failsafeArgLine}</argLine>
        <skip>${skipIntegrationTests}</skip>
        <excludes>
            <exclude>**/unittest/**/*Test.java</exclude>
            <exclude>**/unittest/**/*UT.java</exclude>
        </excludes>
        <includes>
            <include>**/integrationtest/*IT.java</include>
        </includes>
    </configuration>
</plugin>

我已经做了很长时间了。等待你的帮助,谢谢。

0 个答案:

没有答案
相关问题