[英]Cucumber ./features/step_definitions/calculator_steps.rb:15 in '/^the calculator is run$/
I want to make it clear this problem is not about backticks. 我想弄清楚这个问题与反引号无关。 I am new to Cucumber and am trying to run the code from second chapter of The Cucumber Book: Behavior-Driven Development for Testers and Developers.
我是Cucumber的新手,正在尝试运行The Cucumber Book:测试人员和开发人员的行为驱动开发的第二章中的代码。 I am using Cucumber 1.3.19 with ruby 1.9.3p551 in Windows 7 with Ansicon x64 1.60.
我在带有Ansicon x64 1.60的Windows 7中使用带红宝石1.9.3p551的Cucumber 1.3.19。 Cucumber works fine with other code I have received from others, so the configuration is good.
黄瓜可以与我从他人那里收到的其他代码一起正常工作,因此配置很好。 I have read several posts about problems with this tutorial in regards to the backticks already;
我已经阅读了几篇关于本教程中与反引号有关的问题的帖子; however, I have copied the code directly from the Cucumber Book website with the correct backticks (not single quotes) and am still getting the error.
但是,我已经使用正确的反引号(不是单引号)直接从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
My code for adding.feature looks like 我的add.feature代码看起来像
Feature: Adding 功能:添加
Scenario: Add two numbers
Given the input "2+2"
When the calculator is run
Then the output should be "4"
My code for the features/step_definitions/calculator_steps.rb looks like: 我的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
Is there something with the newer version of Cucumber that could render this code bad? 较新版本的Cucumber是否有可能使此代码变得不好的东西?
Thanks for the help. 谢谢您的帮助。 I figured the problem out.
我发现了问题。 calc.rb needed to be in the root directory which was above features and I was putting it in the step_definitions :P.
calc.rb必须位于功能之上的根目录中,我将其放在step_definitions:P中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.