Search code examples
intellij-ideamaven-3cucumber-jvmcucumber-java

Undefined step when executing feature file or individual scenario - Step undefined


Undefined step when executing feature file or individual scenario Script running properly using Runner file, however when try to run feature file directly then I am getting issue "Step undefined You can implement this step using the snippet(s) below:" Also I noticed that test-classes missing in target folder when feature file run directly

I tried invalidate cache option, which not worked

This is project structure

enter image description here

Glue enter image description here

Target Folder structure when feature file executed directly

enter image description here

Target Folder structure when executed using Runner File

enter image description here


Solution

  • Open Run/Debug Configurations, here under before launch, remove Build option and select Build Project and Apply

    enter image description here

    Now Run -- no more "Undefined Steps" Here Build Project option compile the entire project, whereas Build options compile the module.

    https://www.jetbrains.com/help/idea/running-cucumber-tests.html#cucumber-run-configuration

    https://www.jetbrains.com/help/idea/run-debug-configuration-cucumber-java.html#before-launch-options