My build file looks like below and attaching my folder path. When I run the task, It says undefined steps and Its asking to implement steps again.
I have created my own task in gradle to run cucumber test
task seleniumbddTest() {
dependsOn assemble, testClasses
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'html:target/seleniumreport' + getTime() + '.html', '--plugin', 'pretty', '--glue', 'Capsone.steps', 'src/seleniumbdd/resources', '--tags', '@Test']
}
}
}
You should add glue path to your configuration. Glue path specifies Cucumber where your stepDefinitons are. Just add another line to your seleniumbddTest class:
And finally, change "package" with the name of the package where your step definitions are. If your step definitions class is named "steps" and they are under package "stepDefs" , only add "stepDefs" as a glue path. You do not have to provide full path from root.
Also, remove that "--glue" flag from your args
Good luck :)