Jan Kreischer
Jan Kreischer

Reputation: 771

Cucumber with IntelliJ not finding step definitions

I encountered the following issue. I have four Cucumber feature files in IntelliJ. I added the Cucumber support via the IntelliJ plugin. After creating my features I edited my configuration like followed so i can execute the feature files.

This is how my configuration looks like Glue should be the name of the package the step definitions reside in. In my case the package is called stepdefinitions.

The following image shows what my project structure looks like. The feature files reside in /src/test/resource/features while the stepdefinitions are stored in /src/test/java/stepdefinitions. This is how my project structure looks like

Sadly when I try to run the cucumber features with the step definitions I get prompted "You can implement missing steps with the snippets below:" But I already did this. I already copied those snippets to the step definition files. When I hover a scenario IntelliJ tells me *Unimplemented Substep Definition".

Unimplemented Substep Defintion

Those two things lead me to the conclusion that IntelliJ does not find my step definitions. Maybe one of you knows what I am doing wrong.

Upvotes: 8

Views: 40414

Answers (7)

Annie
Annie

Reputation: 1

Do try to run from Runner file and check the formatting of the feature file. Incorrect column formation in example is not allowe and will not parse the file.

Upvotes: 0

Jasmeet Singh
Jasmeet Singh

Reputation: 1

Adding/changing run configuration to run the correct Runner file resolved this issue

Upvotes: 0

Manish Patil
Manish Patil

Reputation: 37

For me, even I have installed latest plugin then also step def where not detecting

I went to my repo - delete .idea folder, and install dependencies again, after analysing and syncing - I restarted ide multiple times, my dependencies started displaying

Then I went to feature files - step defs were detecting

Upvotes: 0

Adnan Siddiqui
Adnan Siddiqui

Reputation: 11

For me, I had to delete & recreate the Run Configuration.

I was clicking the "Run" from the Feature file, and it kept failing. As soon as, I ran it from the Runner class, it worked. Then I looked into Run Configurations, and IntelliJ was running old run profile before I had changed the package name. I deleted all Run Configurations for Cucumber features. Clicked Run on the Feature again, and it worked like a charm.

Upvotes: 1

Haider Malik
Haider Malik

Reputation: 1771

Try 'Invalidate cache and restart'. It worked for me - something the plugin gets stuck.

Upvotes: 1

MAG DAG
MAG DAG

Reputation: 11

Disable the Cucumber plugin to avoid collisions over feature file association, install the Substeps plugin. See http://substeps.github.io/ for more docs on how to use the Substeps BDD framework alongside downloading a sample starter project from here: https://github.com/Substeps/substeps-example/archive/1.1.zip

Upvotes: 0

Jan Kreischer
Jan Kreischer

Reputation: 771

I finally found the solution to my question. The error was caused by a plugin called Substep IntelliJ Plugin. You need to search for it in the IntelliJ Plugin Section and disable or deinstall it.

Upvotes: 10

Related Questions