Jacoco测试报告中的差异
我有一个年级项目,我将某些文件排除在Jacoco报告中。当我运行命令Gradle JacocotestReport
时。显示下面的输出。
Test Coverage:
- Class Coverage: 84.2%
- Method Coverage: 80%
- Branch Coverage: 59.1%
- Line Coverage: 81.8%
- Instruction Coverage: 80.8%
- Complexity Coverage: 62.7%
但是,当我运行Gradle Build
时。我会收到以下错误: -
Execution failed for task ':project:jacocoTestCoverageVerification'.
> Rule violated for bundle project: instructions covered ratio is 0.5, but expected minimum is 0.8
build.gradle: -
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacocoTestReport {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"com/project/commons/infrastructure/**"
])
}))
}
finalizedBy jacocoTestCoverageVerification
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.8
}
}
}
}
有人可以告诉我为什么有差异吗?
I have a grade project and I have excluded certain files from Jacoco reporting. When I run the command gradle jacocoTestReport
. Below output is shown.
Test Coverage:
- Class Coverage: 84.2%
- Method Coverage: 80%
- Branch Coverage: 59.1%
- Line Coverage: 81.8%
- Instruction Coverage: 80.8%
- Complexity Coverage: 62.7%
But when i run gradle build
. I get the below error:-
Execution failed for task ':project:jacocoTestCoverageVerification'.
> Rule violated for bundle project: instructions covered ratio is 0.5, but expected minimum is 0.8
build.gradle:-
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacocoTestReport {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"com/project/commons/infrastructure/**"
])
}))
}
finalizedBy jacocoTestCoverageVerification
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.8
}
}
}
}
Can anyone please tell me why is there a discrepancy ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论