0

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.

enter image description here

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']
        }
    }
}
jeya suriyan
  • 11
  • 1
  • 3
  • 1
    Welcome to SO. People will be happy to help you when you accept or respond to their answers. Please take a look at your old questions and also elaborate this question with more details. – Nandan A Jan 30 '22 at 12:41
  • Yeah for my old questions I'm trying to vote it as correct answer but showing a popup that need some reputation. So not sure what to do. And My current question is elaborated, can you tell me what kind of info you need to give a solution. – jeya suriyan Jan 30 '22 at 12:58

1 Answers1

1

You should add glue path to your configuration. Glue path specifies Cucumber where your stepDefinitons are. Just add another line to your seleniumbddTest class:

glue = "package"

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 :)

Funky Monkey
  • 121
  • 5