如何用Gradle中的不同系统属性值多次运行测试 [英] How to run tests multiple times with different system property values in Gradle

查看:144
本文介绍了如何用Gradle中的不同系统属性值多次运行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在Gradle中运行我的测试套件两次,并为系统属性设置不同的值。现在我可以设置一个系统属性,例如:

  test {
systemPropertyorg.d2ab.sequence.strict ,true
}

但我怎样才能设置属性为false并运行测试套件又是什么?

解决方案

只需添加另一个 Test 任务。

  test {
systemPropertyorg.d2ab.sequence.strict,true
}
任务test2(类型:Test){
systemPropertyorg.d2ab.sequence.strict,false
}
check.dependsOn test2

请参阅 here 查看默认测试任务由 java 插件。

I'd like to know how to run my test suite in Gradle twice, with different values set for a system property. Right now I can set a system property using e.g.:

test {
    systemProperty "org.d2ab.sequence.strict", "true"
}

But how can I set the property to false and run the test suite again?

解决方案

Just add another Test task.

test {
    systemProperty "org.d2ab.sequence.strict", "true"
}
task test2(type: Test) {
    systemProperty "org.d2ab.sequence.strict", "false"
} 
check.dependsOn test2

See here to see where the default test task is added by the java plugin.

这篇关于如何用Gradle中的不同系统属性值多次运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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