Gradle + Selenium is probably not a popular framework yet when I was developing it as I find it difficult to look for relevant resources online. There were bits and pieces of information here and there which I then glue then up together.
My build.gradle contains the following implementations:
(1) Add cucumberRuntime under Configurations
configurations {
cucumberRuntime {
extendsFrom testRuntime
}}
(2) Source sets
sourceSets{
test{
groovy{
srcDirs ‘src/test’
}
}}
(3) Compile test output
task testJar(type: Jar){
from(sourceSets.test.output){
include ‘**/*.class’
exclude ‘**/*StepDef*.class’
}}
(4) Glue everything together
task cucumber() { dependsOn assemble, compileTestJava doLast { javaexec { main = "cucumber.api.cli.Main" classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output args = ['-f', 'json:target/cucumber-report.json','--plugin','pretty', '--glue', 'src/test/groovy/au/com/story/steps', 'src/test/groovy/au/com/story/features'] } } }
Leave a Reply