gpt4 book ai didi

code-coverage - 在 JaCoCo Code Coverage 中排除 Setter 和 Getter

转载 作者:行者123 更新时间:2023-12-04 05:38:17 28 4
gpt4 key购买 nike

cobertura-maven-plugin可以使用 ignoreTrivial 从代码覆盖率中排除 setter 和 getter选项。 jacoco-maven-plugin是否也有这种可能? ?

这是我目前的配置:

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.1.201405082137</version>
<configuration>
<excludes>
<exclude>com/welovecoding/web/blog/test/**/*.class</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>amend-unit-test-java-agent-option</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

最佳答案

官方不支持,见评论:

https://github.com/jacoco/jacoco/issues/15



提到的解决方案:

It's a long time since this issue is opened. It a really interesting feature. For instance it's implemented in clover and corbetura. There are fork that implement filtering : github.com/huangxiwei/jacoco , https://github.com/mchr3k/jacoco since the begining of the year. Why don't you merge those fork into master branch ? Even if all filtering is not implemented at start, main filters needed are listed in the wiki page you have written (Try with resources, sync block, enum static methods). Coverage is a very useful tool, more it's accruate more it's will be usefull. It helps alot when coverage reach a high value, it helps to focus on the right classes.

关于code-coverage - 在 JaCoCo Code Coverage 中排除 Setter 和 Getter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25592437/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com