configurations{cucumberRuntime{extendsFromtestRuntime}}taskcucumber(){dependsOnassemble,compileTestJavadoLast{javaexec{main="cucumber.api.cli.Main"jvmArgs=["-Dwebdriver.chrome.driver=/Users/edfeng/Downloads/chromedriver"]//Must set if you want to use chrome webdriverclasspath=configurations.cucumberRuntime+sourceSets.main.output+sourceSets.test.outputargs=["-g","gradle.cucumber","src/test/resources"]// 1. must set package name of glue code(where steps are defined). 2. must set directory of feature files.}}}
Advanced configuration
Create gradle based project from template
Simply add the following to your ~/.gradle/init.gradle script: