Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined step definitions in IntelliJ

I'm trying to follow this article to match Cucumber specs with step definitions in IntelliJ.

When I press Alt+Enter, I see Inspection 'Undefined Step' options. However, I should see the intention action Create Step Definition.

I thought I had the Cucumber IntelliJ plugin installed, so that shouldn't be a problem. Any help is greatly appreciated.

like image 825
niftygrifty Avatar asked Jul 21 '14 06:07

niftygrifty


5 Answers

Turns out I had the Gherkin plugin but not the Cucumber for Java plugin.

like image 82
niftygrifty Avatar answered Oct 24 '22 05:10

niftygrifty


I wasted around an hour to solve this. My issue was, Idea was able to navigate from feature to step file. But when I wanted to execute one cucumber test from feature file (Right click and Run Scenario), it was giving error as undefined steps.

Solution: In the Edit Configuration -> provide the Glue for the cucumber which should be absolute path till steps folder. Please see below screen shot

enter image description here

This fixed my problem of running feature file from Idea. Hope this helps others.

like image 20
Sanjay Bharwani Avatar answered Oct 24 '22 03:10

Sanjay Bharwani


Most probably you need to install the cucumber for java plugin, if already installed then you need to enable from File>>Settings>>pugins.

like image 3
B. Jha Avatar answered Oct 24 '22 04:10

B. Jha


I had to uncheck the "Create separate module per source set" checkbox under the "Build, Execution, Deployment" -> "Build Tools" -> "Gradle" settings, and then rebuild the project.

Settings

like image 2
Igor Avatar answered Oct 24 '22 05:10

Igor


"Undefined" step error message would appear if you import a new BDD project.

This error could appear due to two reasons.

  1. If you have not installed the "Cucumber for Java" plugin.
  2. If you import any BDD projects then it will not detect step definition file.

Solution: 1. If the plugin is not found then you need to install from the below location. File->Settings->Plugins->MarketPlace->Cucumber for Java 2. After Importing the project disable the plugin and enable once again in the Installed section under Installed.

like image 1
Jagan Avatar answered Oct 24 '22 03:10

Jagan