Intellij cucumber-java plugin: cucumber-jvm 3 step definitions are not recognised

If navigation with Intellij cucumber-java plugin doesn't work and displays all steps in feature file as not implemented, don't get frustrated. I've faced the same situation and I can tell that workaround exists. First, check first if you are using regular expressions or cucumber expressions. Cucumber expressions are introduced since Cucumber 2. In my opinion they are great and look much more cleaner comparing to regexp.

I have 42 cucumbers in my belly

will result in step definition:

I have {int} cucumbers in my {string}

Isn't it awesome? It is! But if you are using Intellij IDEA together with cucumber-java plugin, you won't be able to benefit from cucumber expressions. Tests can be executed, Intellij will pick up correct step definitions but a very important feature is missing now: navigation from step definition to feature file and vice versa is not going to work (it's known and registered issue).

Good news is we still can use regular expressions. And step definition will look pretty much like for previous version of cucumber:

"^I have (\\d+) cucumbers in my (.+)$"

It might be not as cool as Cucumber Expressions but it doesn't limit us in usage of cucumber-java plugin.



Comments