我已经看到了类似的问题,并且尝试了足够多,但无法使其工作。我的build. gradle文件中有测试集,并试图配置Jacoco测试报告以包含我单独的集成测试
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
id 'com.coditory.integration-test' version '1.3.0'
https://github.com/coditory/gradle-integration-test-plugin
我最终使用了上面的插件,一切都很顺利。我得到了单元测试和集成测试的组合测试结果和执行数据的生成。