Cucumber JVM undefined step

Thibault picture Thibault · Feb 13, 2014 · Viewed 41.6k times · Source

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

I wrote my feature file in my features directory, I have also implemented my steps, creating them with the help of the plugin. And my steps in the feature files are recognized by intellij, which can navigate and go to the step implementation.

But when I try to run my scenario, it always fails because for each step, it says "Undefined step : ".

Here is how is organized my project :

file organization

And as I said before, you can see that my steps are recognized by Intellij :

feature file

How is that possible, and how can I correct this?

Any help would be great!

EDIT

Now that I added options to my runner :

@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" )

It works!

Yet, I noticed that before that, I had two scenario outline. One worked perfectly, the other one could not find step definition!

Really weird, since there were some steps in both scenario.

Answer

Bala picture Bala · Feb 13, 2014
@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
}