features/travelling-demo.feature in macros4cuke-0.1.03 vs features/travelling-demo.feature in macros4cuke-0.1.04
- old
+ new
@@ -19,14 +19,15 @@
# You should see the output:
# I leave Brussels
# I arrive in Rome
+
Scenario: Defining a macro calling other macro(s)
Given I define the step "When I [travel from {{origin}} to {{destination}} and back]" to mean:
"""
- {{! The next two steps are, in fact, macro-step invokations}}
+ # The next two steps are, in fact, macro-step invokations
When I [travel from "{{origin}}" to "{{destination}}"]
When I [travel from "{{destination}}" to "{{origin}}"]
"""
Scenario: Do a travel back and forth
@@ -40,26 +41,69 @@
Scenario: Defining a macro that requires a data table
Given I define the step "When I [fill in the form with]:" to mean:
"""
- When I type {{firstname}}
- And I type {{lastname}}
- And I type {{street_address}}
- And I type {{city}}
- And I type {{country}}
+ When I type "{{firstname}}"
+ And I type "{{lastname}}"
+ And I type "{{street_address}}"
+ And I type "{{postcode}}"
+ And I type "{{city}}"
+ And I type "{{country}}"
"""
Scenario: Using a macro-step with a data table
When I [fill in the form with]:
|firstname| Sherlock|
- |lastname|Holmes|
+ |lastname | Holmes |
|street_address| 221B, Baker Street|
- |city|London|
- |country|U.K.|
+ |city |London |
+ |postcode|NW1 6XE |
+ |country | U.K. |
# You should see the output:
# Sherlock
# Holmes
# 221B, Baker Street
# London
# U.K.
+
+
+ When I [fill in the form with]:
+ |firstname| Albert |
+ |lastname | Einstein|
+ |street_address| 22, Mercer Street|
+ |city |Princeton|
+ |country| U.S.A |
+
+ # You should see the output:
+ # Albert
+ # Einstein
+ # 22, Mercer Street
+
+ # Princeton
+ # U.S.A
+
+ # Did you notice the empty line in the previous output.
+ # Guess what? We forgot to specify a value for the postcode argument.
+
+
+Scenario: Demonstrate that it is possible to use a sub-step with a data table
+ Given I define the step "When I [fill in, as a Londonian, the form with]:" to mean:
+ """
+ When I [fill in the form with]:
+ |firstname| {{firstname}}|
+ |lastname | {{lastname}} |
+ |street_address| {{street_address}}|
+ |postcode|{{postcode}} |
+ # The next two lines have hard-coded values
+ |city |London |
+ |country | U.K. |
+ """
+
+ # Let's try...
+ When I [fill in, as a Londonian, the form with]:
+ |firstname| Prime|
+ |lastname | Minister |
+ |street_address| 10, Downing Street|
+
+