我正在尝试使用cobertura为我的常规项目生成覆盖率报告。我正在使用gradle安装cobertura ang junit 5
case class ComponentAvg(@ApiModelProperty (value="..",
example="2.722", dataType="String")
value: String)
运行plugins {
id 'java'
id 'groovy'
id 'net.saliman.cobertura' version '2.5.4'
}
dependencies {
implementation 'org.codehaus.groovy:groovy-all:2.4.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
}
test {
useJUnitPlatform()
}
任务会生成一个空的覆盖率报告(0个类,没有覆盖率)。 jUnit报告显示已运行的正确的单元测试。
栅栏输出
cobertura
> Task :coberturaReport UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :compileGroovy
> Task :processResources NO-SOURCE
> Task :classes
> Task :instrument
Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
> Task :copyCoberturaDatafile
> Task :compileTestJava NO-SOURCE
> Task :compileTestGroovy
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
> Task :generateCoberturaReport
Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Report time: 150ms
> Task :performCoverageCheck SKIPPED
> Task :cobertura
BUILD SUCCESSFUL in 11s
6 actionable tasks: 6 executed
07:53:16: Task execution finished 'cobertura'.
行使我感到困惑,这是问题吗?如何启用覆盖率检查?