Jenkins Java(版本1.8)代码覆盖率

时间:2018-10-23 08:13:46

标签: java jenkins code-coverage

我有用Java版本1.8编写的微服务,并且想将Codecoverage添加到我的Jenkins-Pipeline中。是否有可用于Lambda表达式/流的Java Codecoverage工具?我正在测试Cobertura,但它直接忽略了每个带有Lambda / Stream Imports的类。我尝试使用,但是对我没用?

你们有没有推荐的工具?


这是我的Jacoco设置,也许有人知道为什么它不起作用

<project>
...
  <build>
    <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.2</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><!-- implementation is needed only for Maven 2 -->
                                <rule implementation="org.jacoco.maven.RuleConfiguration">
                                    <element>BUNDLE</element>
                                    <limits><!-- implementation is needed only for Maven 2 -->
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>COMPLEXITY</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.60</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
  </build>
</project>
$mvn clean test jacoco:report 

日志: https://pastebin.com/raw/X6d31crt

0 个答案:

没有答案