gradle-cucumber-plugin
gradle-cucumber-plugin copied to clipboard
Passing jvm arguments to cucumber task
How do I set task properties to the cucumber task from outside the cucumber block?
Normally one would do it like this:
cucumber {
jvmOptions.systemProperties += ["foo": "bar"]
}
But if I want to set properties globally through 'withType' for example, it doesn't work. None of the below gets picked up.
tasks.withType(Test) {task ->
task.systemProperty('foo', 'bar')
}
tasks.withType(JavaExec) {task ->
task.systemProperty('foo', 'bar')
}
The only way I have gotten this to work is to set a system and not task property on Test, e.g. after which I can use retrieve this value inside the cucumber task from System.getProperty()
tasks.withType(Test) {task ->
System.setProperty('foo', 'bar')
}
Why are task properties not propagated?
can you try using tasks.withType(CucumberTask) ? (u might need to import com.excella.gradle.cucumber.tasks.CucumberTask)