Dra*_*lic 2 ruby automated-tests cucumber
我有以下步骤定义(只是为了说明我的问题):
When(/^the calculator is run$/) do
step %{When xxx the calculator is run xxx}
end
When(/^xxx the calculator is run xxx$/) do
@output = `ruby calc.rb #{@input}`
raise('Command failed!') unless $?.success?
end
Run Code Online (Sandbox Code Playgroud)
在我的功能文件中,当我打电话时:
When the calculator is run
Run Code Online (Sandbox Code Playgroud)
我收到了错误消息:
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'
Run Code Online (Sandbox Code Playgroud)
根据文档,这应该工作.最初我有不同文件中的步骤,并认为我可能必须提供一些include指令,但现在即使步骤在同一个文件中也会发生.我错过了什么?
谢谢
max*_*ner 11
在这一行:
step %{When xxx the calculator is run xxx}
Run Code Online (Sandbox Code Playgroud)
删除"何时",它应该正常工作.
您可以在黄瓜文档中查看此内容.step他们给出的例子不包括"何时"这个词.