explore BDD As a developer I want to run Cucumber Scenario: A simple calculation Given two numbers "1" and "2" When I add both together Then I should get "3"
BDD As a developer I want to run Cucumber Scenario: A simple calculation # features/simple.feature:7 Given two numbers "1" and "2" # features/simple.feature:9 When I add both together # features/simple.feature:10 Then I should get "3" # features/simple.feature:11 1 scenario (1 undefined) 3 steps (3 undefined) 0m0.001s You can implement step definitions for undefined steps with these snippets: Given /^two numbers "([^"]*)" and "([^"]*)"$/ do |arg1, arg2| pending # express the regexp above with the code you wish you had end When /^I add both together$/ do pending # express the regexp above with the code you wish you had end Then /^I should get "([^"]*)"$/ do |arg1| pending # express the regexp above with the code you wish you had end If you want snippets in a different programming language, just make sure a file with the appropriate file extension exists where cucumber looks for step definitions.
BDD As a develper I want to run Cucumber Scenario: A simple calculation # features/simple.feature:7 Given two numbers "1" and "2" # features/step_definitions/calculator.rb:1 TODO (Cucumber::Pending) ./features/step_definitions/calculator.rb:2:in /^two numbers "([^"]*)" and "([^"]*)"$/' features/simple.feature:9:in Given two numbers "1" and "2"' When I add both together # features/step_definitions/calculator.rb:5 Then I should get "3" # features/step_definitions/calculator.rb:9 1 scenario (1 pending) 3 steps (2 skipped, 1 pending) 0m0.001s
@num1 = arg1.to_i @num2 = arg2.to_i end When /^I add both together$/ do @result = @num1 + @num2 end Then /^I should get "([^"]*)"$/ do |arg1| raise unless @result == arg1.to_i end
BDD As a develper I want to run Cucumber Scenario: A simple calculation # features/simple.feature:7 Given two numbers "1" and "2" # features/step_definitions/calculator.rb:1 When I add both together # features/step_definitions/calculator.rb:6 Then I should get "3" # features/step_definitions/calculator.rb:10 1 scenario (1 passed) 3 steps (3 passed) 0m0.001s