Jacoco排除类覆盖率报告仅对分支显示为零。

huangapple 未分类评论71阅读模式
英文:

Jacoco exclude class coverage report zero for only branch

问题

我正在尝试从我们的Jacoco报告中排除一个类。我在build.gradle文件中进行了以下操作:

jacocoTestReport {
	dependsOn {
		test
	}
	reports {
		xml.enabled true
	}
	afterEvaluate {
		classDirectories.setFrom(files(classDirectories.files.collect {
			fileTree(dir: it, exclude: [
					'**/DSApplication.class'
			])
		}))
	}
}

这在排除“分支”覆盖范围方面效果良好,但其他选项(如“复杂性”或“行”)仍显示零覆盖率。
我该如何解决?

英文:

I am trying to exclude a class from our jacoco report.
I did the following in build.graddle file:

jacocoTestReport {
	dependsOn {
		test
	}
	reports {
		xml.enabled true
	}
	afterEvaluate {
		classDirectories.setFrom(files(classDirectories.files.collect {
			fileTree(dir: it, exclude: [
					'**/DSApplication.class'
			])
		}))
	}
}

It works well for excluding it from "brunch" coverage but the rest options (like "complexity" or "line") are still showing zero coverage.
How can I fix that?

答案1

得分: 0

显然,在我们用于构建的SonarQube中,有一个选项可以使代码覆盖范围排除得当。

英文:

Apparently there is an option in SonarQube, with we use for build, that makes proper code coverage exclude.

huangapple
  • 本文由 发表于 2020年7月28日 21:52:16
  • 转载请务必保留本文链接:https://java.coder-hub.com/63135745.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定