简体   繁体   中英

Cucumber JVM undefined step

I can't execute a simple test with cucumber for a project. I am on Intellij 13 Community, with cucumber plugin.

And my steps in the feature files are recognized by intellij, which can navigate and go to the step implementation.

@CucumberOptions(  monochrome = true,
        features = "src/test/resources/features/",
        format = { "pretty","html: cucumber-html-reports",
                "json: cucumber-html-reports/cucumber.json" },
        dryRun = false,
        glue = "fr.tlasnier.cucumber" )
@RunWith(Cucumber.class)

@CucumberOptions(  monochrome = true,
                         tags = "@tags",
                     features = "src/test/resources/features/",
                       format = { "pretty","html: cucumber-html-reports",
                                  "json: cucumber-html-reports/cucumber.json" },
                        dryRun = false,
                         glue = "fr.tlasnier.cucumber" )

public class RunCucumber_Test {
  //Run this
}

I've met the same problem. And found that if the package where step definitions exists has not been created in the corresponding source folder. You can try to create a class under fr.tlasnier.cucumber.step, then idea should be able to find the steps. I think it is a bug in Idea.

The class in which the steps are defined should be public. Anything else would throw the undefined step error.

In my case, i was running with intellij cucumber for java plugin, it doesnt automatically detect the glue, so you need to add it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM