IntelliJ with cucumber (java) and step definition location

51,708

Solution 1

Creating self answer for others who might have this problem. My project did not have the steps marked as test source root, and although I DID do this, it was not until I closed and reopened my project that they were picked up. So a simple restart was my answer.

Solution 2

You can set the glue location globally by opening "Edit Configurations -> Defaults -> Cucumber Java -> Glue" and add the package names.

(IntelliJ 12.1.4)

Solution 3

Go File->Settings--> plugins

Install Cucumber for Java plugin

Then you can manage cucumber plugin as shown below This should redirect you to step definition when you click your test.

enter image description here

Hope this helps

Solution 4

IntelliJ supports a plugin for Cucumber-Java/Groovy. Installing this plugin will enable the navigation from Steps mentioned in the feature file to the Step Definitions.

enter image description here

And after creating the Step Definition, navigation is easily possible

enter image description here

Share:
51,708
Owen
Author by

Owen

Leeds based c#/asp.net developer. See: My current open source project - Less Css for .NET My Blog - EngineChris Feel free to contact me at: E: [email protected] Skype: christopher.john.owen T: 07886711645

Updated on July 09, 2022

Comments

  • Owen
    Owen almost 2 years

    Ok, so I'm working on a project using IntelliJ and trying to take advantage of its cucumber functionality. I've not worked with the java flavour of cucumber, but IntelliJ seems to want the step definition files in a specific location, relative to the feature files.

    I found this: how to define step definitions location for cucumber in intelliJ 12 and other sources that pointed me to been able to add the "glue" property of my run configurations which tells cuke which package to find the step file. So I am at a point where I can run my tests via IDEA. BUT I need to set this every time I run a new test, as Ctrl+Alt+F10 or right click+run test will not start the test with this flag. Also, the ide support is screwed as IDEA doesn't know where the steps are, it doesn't auto complte or Ctrl+Click navigate to steps.

    Is there a way to the the IDEA project to always look for steps in a given package both when running the tests and for its auto complete?