Skip to content

Instantly share code, notes, and snippets.

@barneywilliams
Created May 23, 2012 05:37
Show Gist options
  • Save barneywilliams/2773426 to your computer and use it in GitHub Desktop.
Save barneywilliams/2773426 to your computer and use it in GitHub Desktop.
Cucumber-Cpp Example w/Trace
Feature: Division
In order to avoid silly mistakes
Cashiers must be able to calculate a fraction
Scenario: Regular numbers # examples/Calc/CalcFeatures/features/division.feature:6
> ["begin_scenario"]
< ["success"]
> ["step_matches",{"name_to_match":"I have entered 3 into the calculator"}]
< ["success",[{"regexp":"^I have entered (\\d+) into the calculator$","args":[{"val":"3","pos":15}],"id":"1","source":"GTestCalculatorSteps.cpp:11"}]]
> ["invoke",{"args":["3"],"id":"1"}]
< ["success"]
Given I have entered 3 into the calculator # GTestCalculatorSteps.cpp:11
> ["step_matches",{"name_to_match":"I have entered 2 into the calculator"}]
< ["success",[{"regexp":"^I have entered (\\d+) into the calculator$","args":[{"val":"2","pos":15}],"id":"1","source":"GTestCalculatorSteps.cpp:11"}]]
> ["invoke",{"args":["2"],"id":"1"}]
< ["success"]
And I have entered 2 into the calculator # GTestCalculatorSteps.cpp:11
> ["step_matches",{"name_to_match":"I press divide"}]
< ["success",[{"regexp":"^I press divide","args":[],"id":"3","source":"GTestCalculatorSteps.cpp:22"}]]
> ["invoke",{"args":[],"id":"3"}]
< ["success"]
When I press divide # GTestCalculatorSteps.cpp:22
> ["step_matches",{"name_to_match":"the result should be 1.5 on the screen"}]
< ["success",[{"regexp":"^the result should be (.*) on the screen$","args":[{"val":"1.5","pos":21}],"id":"4","source":"GTestCalculatorSteps.cpp:27"}]]
> ["invoke",{"args":["1.5"],"id":"4"}]
< ["success"]
Then the result should be 1.5 on the screen # GTestCalculatorSteps.cpp:27
> ["end_scenario"]
< ["success"]
4 scenarios (4 passed)
16 steps (16 passed)
0m0.073s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment