| 1 |
Feature: Global Context Parameters defined in environment file |
| 2 |
|
| 3 |
. SPECIFICATION: |
| 4 |
. * When a Context parameter is defined in "environment.py", |
| 5 |
. its value is provided to all scenarios (steps). |
| 6 |
. * Each scenario has the same global parameters (and values). |
| 7 |
. * A scenario (step) may modify global parameters (values). |
| 8 |
. * After a scenario is executed all changes to Context parameters are reverted. |
| 9 |
|
| 10 |
Scenario: Test Setup Description (Example) |
| 11 |
Given a file named "features/environment.py" with: |
| 12 |
""" |
| 13 |
def before_all(context): |
| 14 |
context.global_name = "env:Alice" |
| 15 |
context.global_age = 12 |
| 16 |
""" |
| 17 |
|
| 18 |
Scenario: Modify global Context parameter in Scenario Step |
| 19 |
Given the behave context contains: |
| 20 |
| Parameter | Value | |
| 21 |
| global_name | "env:Alice" | |
| 22 |
| global_age | 12 | |
| 23 |
When I set the context parameter "global_name" to "step:Bob" |
| 24 |
Then the behave context should contain: |
| 25 |
| Parameter | Value | |
| 26 |
| global_name | "step:Bob" | |
| 27 |
| global_age | 12 | |
| 28 |
|
| 29 |
Scenario: Ensure that Global Context parameter is reset for next Scenario |
| 30 |
Then the behave context should have a parameter "global_name" |
| 31 |
And the behave context should contain: |
| 32 |
| Parameter | Value | |
| 33 |
| global_name | "env:Alice" | |
| 34 |
| global_age | 12 | |
| 35 |
|