How to run tests multiple times with different sys

2019-09-08 03:29发布

问题:

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?

回答1:

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.



标签: java gradle