[英]Ant Vs Gradle Jacoco code coverage differs
We have migrated from ant
Build tool to Gradle and also upgraded 0.7.4
jacoco
version to latest 0.8.6
version.我们已经从
ant
构建工具迁移到 Gradle 并将0.7.4
jacoco
版本升级到最新0.8.6
版本。
I observed that the jacoco Reports
are slightly lowered (~1%) in Gradle-6.6.1
build compare to Ant-1.7.0
as seen below.我观察到,与
Ant-1.7.0
相比, Gradle-6.6.1
构建中的jacoco Reports
略有降低(~1%),如下所示。
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.fork = true
options.incremental = true
options.encoding = 'UTF-8'
options.debug = true
}
Ant compile Ant 编译
<javac srcdir="${src}"
destdir="${classes}"
excludes="**/package-info.java"
debug="true"
fork="true"
memoryMaximumSize="${javacCoreMaxMem}"
includeAntRuntime="false"
encoding="UTF-8">
<classpath>
<pathelement path="${deps}" />
</classpath>
</javac>
I've made sure that Ant
compile args and Gradle
compileJava Args should match.我确保
Ant
compile args 和Gradle
compileJava Args 应该匹配。 But not sure why there is discrepancies in reports?但不确定为什么报告中存在差异?
I've made sure that Ant compile args and Gradle compileJava Args should match.
我确保 Ant compile args 和 Gradle compileJava Args 应该匹配。
But you are comparing different versions of JaCoCo但是您正在比较不同版本的 JaCoCo
also upgraded 0.7.4 jacoco version to latest 0.8.6 version
还将 0.7.4 jacoco 版本升级到最新的 0.8.6 版本
Please have a look at changes between these versions - https://www.jacoco.org/jacoco/trunk/doc/changes.html请查看这些版本之间的更改 - https://www.jacoco.org/jacoco/trunk/doc/changes.html
There are many that change how metrics such as number of instructions or branches are computed.有许多改变了诸如指令或分支数量等指标的计算方式。
As one of examples in 0.7.5 there is作为 0.7.5 中的示例之一,有
Better detection of coverage in code blocks with implicit exceptions
更好地检测具有隐式异常的代码块中的覆盖率
As another example in 0.8.0 there is作为 0.8.0 中的另一个示例,有
During creation of reports various compiler generated artifacts are filtered out, which otherwise require unnecessary and sometimes impossible tricks to not have partial or missed coverage
在创建报告期间,各种编译器生成的工件被过滤掉,否则需要不必要的,有时是不可能的技巧来避免部分或遗漏的覆盖
See also for example https://stackoverflow.com/a/42680333/244993 which shows example where numbers are different between different versions.另请参见例如https://stackoverflow.com/a/42680333/244993 ,其中显示了不同版本之间数字不同的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.