我在基于 Gradle 的项目中定义了一个自定义 sourceSet,如下所示:
sourceSets {
componentTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/componentTest/java')
}
}
}
configurations {
componentTestImplementation.extendsFrom testImplementation
}
task componentTest(type: Test) {
dependsOn assemble
testClassesDirs = sourceSets.componentTest.output.classesDirs
classpath = sourceSets.componentTest.runtimeClasspath
outputs.upToDateWhen { false }
testLogging.showStandardStreams = true
mustRunAfter(test)
}
check.dependsOn(componentTest)
sourceSet 包含 Cucumber 功能。
运行 Jacoco 时,生成的jacocoTestReport.xml文件似乎不包括 Cucumber 测试生成的覆盖率。
这是 Jacoco 配置:
jacocoTestReport {
executionData(
file("${project.buildDir}/jacoco/test.exec"),
file("${project.buildDir}/jacoco/componentTest.exec"),
)
}
我能做些什么来在 xml 文件中获得与在 exec 文件中相同的覆盖率吗?