【问题标题】:Jacoco test report does not include integrationTestJacoco 测试报告不包括 integrationTest
【发布时间】: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


【解决方案1】:
id 'com.coditory.integration-test' version '1.3.0'

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-04
    • 2020-06-28
    • 2019-02-17
    • 1970-01-01
    • 1970-01-01
    • 2018-07-09
    • 1970-01-01
    • 2019-05-27
    相关资源
    最近更新 更多