在我的 gradle 构建中,我有 2 个这样的测试任务:
task testAAA(type: Test) {
filter {
includeTestsMatching "*AAA*"
}
finalizedBy jacocoTestReport
}
和
task testBBB(type: Test) {
filter {
includeTestsMatching "*BBB*"
}
finalizedBy jacocoTestReport
}
这会在 build/jacoco 中生成 2 个 .exec 文件:
测试AAA.exec
testBBB.exec
我想生成一个单一的覆盖率报告,该报告从两个/所有 .exec 文件中获取输入,我试过这个:
jacocoTestReport {
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
reports {
xml.enabled true
}
}
当我尝试出现此错误时:
Execution failed for task ':Project1:jacocoTestReport'.
> Unable to read execution data file Project1/build/jacoco/test.exec
Project1/build/jacoco/test.exec (No such file or directory)
当我明确提供 executionData 规范时,为什么 jacocoTestReport 会寻找“test.exec”?