【发布时间】:2021-07-08 06:26:20
【问题描述】:
我已经看到了类似的问题,并且尝试了足够多的方法,但无法使其正常工作。我的 build.gradle 文件中有测试集,并尝试配置 Jacoco 测试报告以包含我单独的 integrationTest
build.gradle
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.5
}
}
}
}
jacocoTestReport {
// Gather execution data from all subprojects
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
sourceSets sourceSets.main
reports {
html.enabled true
}
}
test.finalizedBy jacocoTestReport // report is always generated after tests run
jacocoTestReport.dependsOn test, integrationTest // tests are required to run before generating the report
check.dependsOn integrationTest, jacocoTestCoverageVerification
【问题讨论】:
-
您能否为您的 integrationTest 任务添加代码,以查看 .exec 文件正在生成到正确的位置
-
这就是我所拥有的 integrationTest,因为我使用的是 github 文档中的默认值。
testSets { integrationTest } -
@Aswath 不,它没有帮助。感谢您的回复
标签: spring-boot gradle jacoco