简体   繁体   English

黄瓜功能文件在命令行上运行,但不在Intellij中运行:无法加载步骤定义(未定义)

[英]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. 黄瓜功能文件在命令行上运行,但不在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 我正在使用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: 在命令行上,我导航到Cucumber文件夹:

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. 当我尝试在Intellij中运行黄瓜测试用例时,Intellij无法找到/加载步骤定义。 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: 在[Bundler]标签下:

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

Suggestions? 有什么建议吗?

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 我的工作目录:/ user / jchiang / test / cucumber我的cucubmer功能文件:/ user / jchiang / test / cucumber / features我的cucubmer步骤定义:/ user / jchiang / test / cucumber / lib

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM