IntelliJ Idea not able to recognize some Cucumber Steps
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 containstep_definitions
asGlue
- The code is building
After those checks the steps should be recognized.
Solution 2
Following steps will help in 90% cases:
- Install Cucumber plugin for Java and(or) groovy
- Mark feature folder as test resources root and steps folder as test sources root
Comments
-
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 almost 4 yearsDo you have any links to explain why the feature or step definitions file must be marked as described? Very helpful, btw.