cucumber.options with gradle

Posted by Dan Siwiec on December 22, 2014 cucmber maven gradle

So, to make Gradle work like the maven:

mvn test -Dcucumber.options="..."

you have to do some extra magic. When Gradle forks a new process dedicated for tests it doesn’t automatically forward the original system properties. In order to achieve this, the following needs to be added:

test {systemProperties =}

Now you can use just do:

gradle -Dcucumber.options="..." test

and the options will be applied properly.

If you have multiple test tasks, you can also do it in one stab:

tasks.withType(Test) {systemProperties =}

For a full working example check out my fork of cucumber-java-skeleton, adding gradle support.