使用junitPlatform时设置系统属性 [英] Setting system properties when using junitPlatform
本文介绍了使用junitPlatform时设置系统属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当使用Gradle执行JUnit 5测试时,我找不到如何设置系统属性。标准 test
任务可以配置如下:
I could not find out how to set system properties when executing JUnit 5 tests using Gradle. The standard test
task could be configured as follows:
test {
systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'warn'
}
然而, junitPlatform
任务似乎没有这样的选项。
However, the junitPlatform
task seem to not have such an option.
推荐答案
正如我在这里所述,您可以设置系统属性这:
As I mentioned here, you can set system properties like this:
afterEvaluate {
def junitPlatformTestTask = tasks.getByName('junitPlatformTest')
junitPlatformTestTask.systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'warn'
}
这篇关于使用junitPlatform时设置系统属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文