gradle-cucumber-plugin icon indicating copy to clipboard operation
gradle-cucumber-plugin copied to clipboard

Passing jvm arguments to cucumber task

Open Darkvater opened this issue 9 years ago • 1 comments

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?

Darkvater avatar Dec 03 '15 03:12 Darkvater

can you try using tasks.withType(CucumberTask) ? (u might need to import com.excella.gradle.cucumber.tasks.CucumberTask)

tommywo avatar Dec 07 '15 10:12 tommywo