[英]Why do I get 'Undefined dynamic step' in 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
在我的功能文件中,當我打電話時:
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}
刪除“何時”,它應該正常工作。
您可以在黃瓜文檔中查看此內容。 他們給出的step
示例不包括“何時”一詞。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.