Undefined step definitions in IntelliJ

55,521

Solution 1

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

Solution 2

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.

Solution 3

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

Solution 4

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

Solution 5

"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.

Share:
55,521

Related videos on Youtube

niftygrifty
Author by

niftygrifty

Updated on August 31, 2020

Comments

  • niftygrifty
    niftygrifty over 3 years

    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.

  • bcody
    bcody over 8 years
    Thank you! I just ran in to the same problem. I set up a new project, opened a .feature file, IntelliJ suggested to install a plugin for me with which I can edit that .feature file, so I let it do its thing. It only included Gherkin, but not Cucumber for Java. After manually including the CfJ plugin, it worked.
  • romulusnr
    romulusnr over 8 years
    Ditto! I think it's silly for IJ to come bundled with the vanilla Gherkin plugin but not any Cucumbery plugins to go with it. IJ should come with CfJ (and maybe CfG too) which also bring in the Gherkin plugin as dependency.
  • Christoph Zabinski
    Christoph Zabinski about 8 years
    I probably havve the same Problem but can't get a handle on it. I have imported gherkin as well as cucumber (groovy) via the maven importer and the jars were downloaded correctly but no way of using alt + enter for creating stepDev. how exactly did you guys proceed ?
  • Tetrinity
    Tetrinity over 6 years
    To add to this, I accidentally had the SubSteps plugin installed, which seems to conflict with Cucumber for Java in interesting ways. Uninstalling that fixed the issues I had.
  • learner
    learner over 6 years
    Thanks Sanjay. Also to include multiple step folders, enter the name with spaces in Glue textbox in intellij.
  • davidfrancis
    davidfrancis over 5 years
    My Configuration had been auto generated by Intellij on the right click -> Run. So I just deleted the configuration and re-ran the right click Run option
  • Balaji Venkatachalam
    Balaji Venkatachalam about 3 years
    This really helped me to solve the issue - a great pointer for the issue!!
  • Mukesh Rajput
    Mukesh Rajput about 3 years
    For me it's Sub steps plugin that was creating the same issue, after disabling it, linking is working fine
  • user2201789
    user2201789 over 2 years
    @Sanjay I hit undefined scenarios issue, what should be input at glue? i have put the path till reaching the feature file like this but it does not helps "\src\test\resources\features\creating_todos"
  • Sanjay Bharwani
    Sanjay Bharwani over 2 years
    @user12158726 Glue should point to the folder where your steps exists and the feature or folder path should point to the folder where your feature file exists.
  • user2201789
    user2201789 over 2 years
    I found out just need to input the package name in glue.