gradle-cucumber-plugin
gradle-cucumber-plugin copied to clipboard
Undefined steps when running gradle cucumber
Referenced from #27 https://github.com/samueltbrown/gradle-cucumber-plugin/issues/27#issuecomment-294860608 as it is closed.
Hi @viphe I am also having the similar problem when I used gradle cucumber it complained steps are undefined. I am using cucumber-jvm with scala. I am using this plugin version 0.9, cucumber version is 1.2.5 and my gradle version is 3.5. I added the glueDirs as
classpath:and also hard coded the path but it still says steps are undefined. Any progress on this issue?
cucumber {
formats = ['pretty','json:build/cucumber.json']
glueDirs = ['classpath:step_definition_package_name']
featureDirs = ['path_to_feature']
tags = ['@wip']
monochrome = false
strict = false
dryRun = false
ignoreFailures = false
jvmOptions {}
}
When I added a task as below in build.gradlew file and ran with new task, the tests run
task cucumber12(type: JavaExec, dependsOn: assemble ) {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['-f', 'json:build/reports/cucumber/cucumber.json', '--glue', 'step_definition_package_name', 'path_to_feature']
}
Why I am not able to use this plugin but able to run via new task added?
Same here. Is not able to find my Java step definitions. I have step definitions in
src/test/java/com/myapp/test/cucumber/StepDefs.java
and the feature file in
src/test/resources/com/myapp/test/cucumber/test.feature
When I run the task it finds the feature, but says all the steps are uninplemented. If I run using the JUnit test runner, it finds the steps without any problems and executes the BDD correctly.
My config
cucumber {
formats = ['pretty','junit:build/cucumber.xml']
glueDirs = ['src/test/java']
featureDirs = ['src/test/resources']
tags = []
monochrome = false
strict = false
dryRun = false
ignoreFailures = false
jvmOptions {
maxHeapSize = '512m'
}
}
As soon as I upgraded from gradle 2.8 to 4.3, the step definitions are not being recognized.
tasks.cucumber { formats = ['pretty', 'json:build/cucumber-tests/cucumber.json', 'html:build/cucumber-tests/cucumber_results.html'] }
I know that this is an old thread, but I also had a problem running the cucumber gradle task...
task cucumber() {
dependsOn assemble
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--glue', 'hellocucumber', 'src/test/resources']
}
}
}
the --glue switch in this gradle task arguments is what I had to change to fix the issue.
I changed "hellocucumber" to the correct package name I'm using in my project...I hope it helps someone who finds this thread in the future.
I know that this is an old thread, but I also had a problem running the
cucumbergradle task...task cucumber() { dependsOn assemble doLast { javaexec { main = "io.cucumber.core.cli.Main" classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output args = ['--plugin', 'pretty', '--glue', 'hellocucumber', 'src/test/resources'] } } }the
--glueswitch in this gradle task arguments is what I had to change to fix the issue. I changed "hellocucumber" to the correct package name I'm using in my project...I hope it helps someone who finds this thread in the future.
I was having the same issue I had to put the full package path instead of just "hellocucumber" ' so at the end got --glue', 'com/jmconsultant/hellocucumber'