Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 为什么我会得到';未定义的动态步长';黄瓜?_Ruby_Cucumber_Automated Tests - Fatal编程技术网

Ruby 为什么我会得到';未定义的动态步长';黄瓜?

Ruby 为什么我会得到';未定义的动态步长';黄瓜?,ruby,cucumber,automated-tests,Ruby,Cucumber,Automated Tests,我有以下步骤定义(只是为了说明我的问题): 在我的功能文件中,当我调用时: When the calculator is run 我收到了错误消息: Undefined dynamic step: "When xxx the calculator is run xxx" (Cucumber::UndefinedDynamicStep) ./features/step_definitions/calculator_steps_when.rb:2:in `/^the calculator is r

我有以下步骤定义(只是为了说明我的问题):

在我的功能文件中,当我调用时:

When the calculator is run
我收到了错误消息:

Undefined dynamic step: "When xxx the calculator is run xxx" (Cucumber::UndefinedDynamicStep)
./features/step_definitions/calculator_steps_when.rb:2:in `/^the calculator is run$/'
features/adding.feature:11:in `When the calculator is run'
features/adding.feature:6:in `When the calculator is run'
根据文件,这应该是可行的。起初我在不同的文件中有步骤,我想可能我必须提供一些include指令,但现在即使步骤在同一个文件中也会发生。我错过了什么

感谢您在这一行:

  step %{When xxx the calculator is run xxx}
移除“何时”按钮,它应该可以正常工作


你可以在网上查一下。他们给出的
步骤
示例中没有“When”一词。

是的,它很有效,谢谢。我还注意到,如果我将“步骤”改为“步骤”,也会起作用。因此,步骤%{xxx计算器运行xxx}或步骤“xxx计算器运行xxx”或步骤%{xxx计算器运行xxx}都可以,但我使用的一个没有。谢谢-我发现,如果您使用
步骤
进行动态表步骤,您也恰好需要
When/And/Then
前缀。
  step %{When xxx the calculator is run xxx}