Jacoco代码覆盖率报告未生成集成测试,未在声纳中显示

时间:2017-04-16 04:36:16

标签: maven jacoco

我在Maven配置了Jacoco + Sonar。我能够生成单元测试的覆盖率报告。显示Sonar的覆盖范围。但是,无法生成集成测试的报告。 " jacoco-it.exec"生成但是,当我去打开index.html时,它看起来是空的。但是,有许多集成测试已经执行并且已经执行。也过去了。在jacoco-sessions.html中,清楚地提到了内部使用的所有类。如果你知道下面的代码集成测试有什么问题,请帮助我。我也正确配置了Sonar&给出了获取集成测试结果的路径。如果您有任何想法,请查看一次并帮助我。 pom.xml:

    <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
    <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
    <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>  
 </configuration>
<executions>
<execution>
 <id>pre-integration-test</id 
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals> </execution>
 <execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>                                                                                                                                                                                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <systemPropertyVariables>
                        <jacoco-agent.destfile>${project.build.directory}/coverage-reports/jacoco-it.exec</jacoco-agent.destfile>
                    </systemPropertyVariables>
                    <encoding>UTF-8</encoding>
                    <skipTests>false</skipTests>
                    <runOrder>alphabetical</runOrder>
                    <includes>
                        ....<There are integration tests>
                    </includes>
                    <excludes>
                        ....
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal> 
                        </goals>
                    </execution>
                </executions> 
            </plugin>

0 个答案:

没有答案