satoukum
satoukum

Reputation: 1258

Cucumber feature file runs on the command line but not in Intellij: Can't load step definitions (undefined)

The Cucumber feature file runs on the command line, but not in Intellij. I believe this means there are additional configuration steps that I'm missing.

I am using Windows 7, Intellij IDEA 13.1.3, Ruby 1.9.3, Cucumber 1.3.4

Here is my project folder structure:

\cucumber
  \projectName
    \features
     -mainFeature.feature
      \step_definitions
       -helperFeature.feature

On the command line I navigate to the cucumber folder:

E:\path\to\cucumber\folder\

Then I execute the following command:

bundle exec cucumber projectName/features/mainFeature.feature

And this command runs the cucumber test case successfully.

When I try to run the cucumber test case in Intellij, Intellij is unable to find/load the step definitions. It says that I "can implement step definitions for undefined steps with these snippets" for every single step I use in my features.

The specific error message is:

You can implement step definitions for undefined steps with these snippets:

Then(/^verify the same\-date destination airport grouping strategy$/) do
  pending # express the regexp above with the code you wish you had
end
1 scenario (1 undefined)
5 steps (5 undefined)
0m0.014s

Under "Run > Edit Configurations" I've defined the following on the configuration tab:

Feature file:          E:\path\to\cucumber\folder\projectName\features\scratchpad_grouping_strategy.feature
Runner options:        --color -r features
'cucumber' gem:        1.3.4
Working directory:     E:\path\to\cucumber\folder\
Environment variables: [environment variables]
Ruby arguments:        -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift);
Ruby SDK:              Use other SDK  -> 'cucumber' gem: ruby 1.9.3

And under the Bundler tab:

Run the script in context of the bundle (bundle exec) is checked

Suggestions?

Upvotes: 0

Views: 5187

Answers (1)

Jessica Chiang
Jessica Chiang

Reputation: 1046

I had to specify my working directory correctly. Below is my directory

My working directory: /user/jchiang/test/cucumber My cucubmer feature files: /user/jchiang/test/cucumber/features My cucubmer step definitions:/user/jchiang/test/cucumber/lib

enter image description here

Upvotes: 0

Related Questions