如何让 Gradle 构建生成 HTML 测试报告而不是默认的 XML?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25963554/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:44:26  来源:igfitidea点击:

How to make Gradle build produce HTML test report instead of XML default?

htmljunitgradlereport

提问by smeeb

Currently I build my Gradle app by running gradle clean build. This exercises JUnit tests and produces XML test results in my project under build/test-results. I would like to configure my build.gradlefile to produce HTML test results (instead of the XML default). Is this possible, if so, how?

目前我通过运行gradle clean build. 这将练习 JUnit 测试并在我的项目中生成 XML 测试结果build/test-results。我想配置我的build.gradle文件以生成 HTML 测试结果(而不是 XML 默认值)。这是可能的,如果是这样,如何?

回答by Peter Niederwieser

test {
    reports {
        junitXml.enabled = false
        html.enabled = true
    }               
}

To figure this out on your own, start from Testin the Gradle Build Language Reference, then drill down into (the type for) reports.

为了搞清这一点上你自己的,从开始Test摇篮构建语言参考,然后深入到(该类型)reports