【问题标题】:Test report gets overwritten测试报告被覆盖
【发布时间】:2017-03-20 16:04:09
【问题描述】:

我的项目中有单元测试和集成测试,它们由@Category 分隔,因此它们可以按顺序执行:

test {
    useJUnit {
        includeCategories '....UnitTest'
    }
}

task itTest(type: Test, dependsOn: tasks.test) {
    useJUnit {
        includeCategories '....IntegrationTest'
    }
}

运行任务 itTest 会根据需要首先执行单元测试,然后执行集成测试,但单元测试报告不包含在摘要中。 This 建议有解决此问题的方法,但我不确定如何将该 sn-p 包含到我的 build.gradle 中。感谢您的帮助!

【问题讨论】:

    标签: spring unit-testing gradle integration-testing


    【解决方案1】:

    在较新的 Gradle 版本(我认为是 > 3.0)中,测试报告的路径包括任务名称,因此它避免了覆盖结果。对于早期的 gradle 版本,您可以手动设置报告路径以避免多个任务使用同一个报告文件夹。例如:

    itTest.reports.html.destination = file("$buildDir/reports/itTest")

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多