提问者:小点点

Jacoco测试报告不包括集成测试


我已经看到了类似的问题,并且尝试了足够多,但无法使其工作。我的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

共1个答案

匿名用户

id 'com.coditory.integration-test' version '1.3.0'

https://github.com/coditory/gradle-integration-test-plugin

我最终使用了上面的插件,一切都很顺利。我得到了单元测试和集成测试的组合测试结果和执行数据的生成。