Cucumber with IntelliJ not finding step definitions
Asked Answered
T

7

8

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.

Troglodyte answered 22/1, 2019 at 11:47 Comment(1)
Your Glue setting should point to the java classes, not your step defintions.Lozano
T
10

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.

Troglodyte answered 23/1, 2019 at 10:3 Comment(3)
I was also had this issue.Strawberry
This solution didn't help me. Substep IntelliJ Plugin was disabled. I uninstalled it, restarted Intellij. It didn't help: steps in .feature files are still not recognized.Horseman
I do not see any plugin with name Substep IntelliJ Plugin installed in my Intellij. I still cann't locate the steps.Blocky
E
1

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

Easement answered 15/7, 2022 at 14:20 Comment(0)
K
1

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.

Koerlin answered 22/9, 2023 at 13:49 Comment(0)
B
0

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

Bunt answered 2/11, 2019 at 2:6 Comment(0)
C
0

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

Coffeecolored answered 16/5 at 13:14 Comment(0)
L
0

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

Lucubrate answered 17/6 at 11:48 Comment(0)
Y
0

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.

Yalu answered 21/6 at 16:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.