Kotlin Spek-如何使用测试报告生成XML? [英] Kotlin Spek - How to generate XML with tests report?
问题描述
我正在使用Spek来测试我的Kotlin应用程序.我想在詹金斯建立之后发布我的测试报告. JUnit或TestNG将生成XML报告,Jenkins可以使用该报告来生成测试统计信息.
I am using Spek to test my Kotlin app. I would like to publish my tests report after Jenkins build. JUnit or TestNG would generate XML report which Jenkins can use to generate tests stats.
Spek会生成这样的报告吗?如果是这样,如何配置我的Gradle项目来获得它?如果没有,还有哪些其他报告选项可用?
Does Spek generate such report? If so, how to configure my Gradle project to get it? If not, what are the other reporting options available?
推荐答案
我没有彻底检查我的build
目录.由于Spek使用的是JUnit 5平台引擎,它将以与JUnit 5相同的方式生成报告.
I haven't checked thoroughly my build
directory. Since Spek is using JUnit 5 Platform Engine it will produce reports the same way as JUnit 5 would have done.
确实,运行./gradlew clean build
后,您可以在这里看到文件:./build/reports/junit/TEST-spek.xml
.构建后,我使用Jenkins来发布JUnit XML报告,并且效果很好.
Indeed, after running ./gradlew clean build
you can see the file here: ./build/reports/junit/TEST-spek.xml
. I used Jenkins to publish JUnit XML report after build and it works fine.
如果您想更改报告目录,则应按以下步骤在Gradle构建脚本中对其进行配置.
If you'd like to change reports directory, you should configure it in Gradle build script as follows.
junitPlatform {
reportsDir file("$buildDir/your/path")
filters {
engines {
include 'spek'
}
}
}
JUnit 5用户指南的来源: http://junit.org/junit5/docs/current/user-guide/#running-tests-build
Source, JUnit 5 User guide: http://junit.org/junit5/docs/current/user-guide/#running-tests-build
这篇关于Kotlin Spek-如何使用测试报告生成XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!