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. I am using Cucumber 1.3.19 with ruby 1.9.3p551 in Windows 7 with Ansicon x64 1.60. 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.
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
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:
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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.