IntelliJ Idea not able to recognize some Cucumber Steps

11,026

Solution 1

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.

Solution 2

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
Share:
11,026
shashi
Author by

shashi

Building @gettrici http://www.gettrici.com

Updated on June 04, 2022

Comments

  • shashi
    shashi almost 2 years

    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.

  • Mate Mrše
    Mate Mrše almost 4 years
    Do you have any links to explain why the feature or step definitions file must be marked as described? Very helpful, btw.