Cucumber example - test::unit, scenario outlines, datafile driven test
Archive - Originally posted on "The Horse's Mouth" - 2015-01-09 01:58:23 - Graham EllisAnother Cucumber example - this time using test::unit, and with tables of cases in both the feature file and a separate data file.
Running the code:
WomanWithCat:s2015 grahamellis$ cucumber behaviourtable
Feature: Checking some things on quotations
Scenario: Checking VAT rules # behaviourtable/quotation.feature:4
Given I ask for a quotation # behaviourtable/step_definitions/quotation_steps.rb:40
Then Check against each example in a file or database # behaviourtable/step_definitions/quotation_steps.rb:44
tested SN12 5RR
tested Belgium
tested 90211
Scenario Outline: Checking area identification # behaviourtable/quotation.feature:8
Given I ask for a quotation for "" postcode # behaviourtable/step_definitions/quotation_steps.rb:27
When I visit our quotation web page # behaviourtable/step_definitions/quotation_steps.rb:32
Then I am told it is valid for "" # behaviourtable/step_definitions/quotation_steps.rb:36
Examples:
| locationpostcode | placename |
| CA5 1RJ | Whitehaven |
| 12345 | New York |
| Spain | Madrid |
4 scenarios (4 passed)
11 steps (11 passed)
0m42.262s
WomanWithCat:s2015 grahamellis$
Feature file - [here]
Step file - [here]
Data file - [here]
Lots and lots of things shown here - the end of a build-up example from this week's Ruby course tuned towards Cucumber.