[英]Cucumber ./features/step_definitions/calculator_steps.rb:15 in '/^the calculator is run$/
我想弄清楚這個問題與反引號無關。 我是Cucumber的新手,正在嘗試運行The Cucumber Book:測試人員和開發人員的行為驅動開發的第二章中的代碼。 我在帶有Ansicon x64 1.60的Windows 7中使用帶紅寶石1.9.3p551的Cucumber 1.3.19。 黃瓜可以與我從他人那里收到的其他代碼一起正常工作,因此配置很好。 我已經閱讀了幾篇關於本教程中與反引號有關的問題的帖子; 但是,我已經使用正確的反引號(不是單引號)直接從Cucumber Book網站復制了代碼,仍然出現錯誤。
Command failed! <RuntimeError>
./features/step_definitions/calculator_steps.rb:15 in '/^the calculator is run$/
features\adding.features:5:in 'When the calculator is run'
Failing Scenarios:
cucumber features\adding.feature: 3
我的add.feature代碼看起來像
功能:添加
Scenario: Add two numbers
Given the input "2+2"
When the calculator is run
Then the output should be "4"
我的features / step_definitions / calculator_steps.rb代碼如下:
Given /^the input "([^"]*)"$/ do |input|
@input = input
end
When /^the calculator is run$/ do
@output = `ruby calc.rb #{@input}`
raise('Command failed!') unless $?.success?
end
Then /^the output should be "([^"]*)"$/ do |expected_output|
@output.should == expected_output
end
較新版本的Cucumber是否有可能使此代碼變得不好的東西?
謝謝您的幫助。 我發現了問題。 calc.rb必須位於功能之上的根目錄中,我將其放在step_definitions:P中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.