2
votes

I was trying to develop a module using BDD i.e. using Cucumber. This is the first time that I am trying this. I have defined two Scenarios in my Feature and using IntelliJ itself, I have created Steps for both the scenarios in a particular file.

However, on running the tests, the runner cannot find steps defined for the second scenario, even though they are in the same file as the steps for the first scenario.

The steps for the first scenario execute without any issues.

===EDIT====

Just to reiterate, the config under which the tests are running has the glue defined which identifies the steps for the first scenario, so it should be able to do the same for the second scenario as well, but doesn't. I have restarted the IDE, but to no avail.

===EDIT 2====

Ok, So now none of the steps are being recognized. Even the steps defined for First scenario are not being found by the runner.

3

3 Answers

3
votes

Please make sure that:

  • Cucumber for java plugin is installed and compatible with your intellij idea version
  • \src\main\resources is marked as Resources Root
  • \src\main\resources contains the files .feature
  • \src\main\java is marked as Sources Root
  • \src\main\java contain the folder step_definitions
  • The Feature configuration in the run test class contain step_definitions as Glue
  • The code is building

After those checks the steps should be recognized.

1
votes

Following steps will help in 90% cases:

  1. Install Cucumber plugin for Java and(or) groovy
  2. Mark feature folder as test resources root and steps folder as test sources root
0
votes

I know this is old question, but check if your scenarios description have dots(.) in them, if you see just remove those dots(.) and check. Like

Scenario: Some determinable business situation.

to

 Scenario: Some determinable business situation