使用聚合的gradle TestReport多的测试结果 [英] aggregating gradle multiproject test results using TestReport

查看:270
本文介绍了使用聚合的gradle TestReport多的测试结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目的结构看起来像下面。我想使用TestReport在摇篮功能聚合所有测试结果到一个单独的目录。
然后,我可以通过为所有子项目一个index.html文件访问所有的测试结果。
我怎样才能做到这一点?

 
| --ProjectA
  | --src /测试/ ...
  | --build
    | --reports
      | --tests
        | --index.html(testresults)
        | - ..
        | - ..
| --ProjectB
    | --src /测试/ ...
      | --build
        | --reports
          | --tests
            | --index.html(testresults)
            | - ..
            | - ..


解决方案

从的例23.13。创建单元测试报告子项目在摇篮用户指南 的:

 的子项目{
    应用插件:Java的    //禁用各个测试任务,测试报告
    测试{
        reports.html.enabled = FALSE
    }
}任务testReport(类型:TestReport){
    destinationDir =文件($ buildDir /报告/ ALLTESTS)
    //包含从`所有子项目test`任务的结果
    reportOn子项目* .TEST
}

全工作示例可从样本/测试/ testReport 在充分摇篮分配。

I have a project structure that looks like the below. I want to use the TestReport functionality in Gradle to aggregate all the test results to a single directory. Then I can access all the test results through a single index.html file for ALL subprojects. How can I accomplish this?

.
|--ProjectA
  |--src/test/...
  |--build
    |--reports
      |--tests
        |--index.html (testresults)
        |--..
        |--..
|--ProjectB
    |--src/test/...
      |--build
        |--reports
          |--tests
            |--index.html (testresults)
            |--..
            |--..

解决方案

From Example 23.13. Creating a unit test report for subprojects in the Gradle User Guide:

subprojects {
    apply plugin: 'java'

    // Disable the test report for the individual test task
    test {
        reports.html.enabled = false
    }
}

task testReport(type: TestReport) {
    destinationDir = file("$buildDir/reports/allTests")
    // Include the results from the `test` task in all subprojects
    reportOn subprojects*.test
}

Fully working sample is available from samples/testing/testReport in the full Gradle distribution.

这篇关于使用聚合的gradle TestReport多的测试结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆