[英]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.