| 1 |
@issue |
| 2 |
Feature: Issue #384 -- Active Tags fail with ScenarioOutline |
| 3 |
|
| 4 |
. ScenarioOutline can currently not be used with active-tag(s). |
| 5 |
. REASON: Template mechanism transforms active-tag into invalid active-tag per example row. |
| 6 |
. |
| 7 |
. RELATED: features/tag.active_tags.feature |
| 8 |
|
| 9 |
|
| 10 |
Background: |
| 11 |
Given a new working directory |
| 12 |
And a file named "features/steps/pass_steps.py" with: |
| 13 |
""" |
| 14 |
from behave import step |
| 15 |
|
| 16 |
@step('{word:w} step passes') |
| 17 |
def step_passes(context, word): |
| 18 |
pass |
| 19 |
|
| 20 |
# -- REUSE: Step definitions. |
| 21 |
from behave4cmd0 import note_steps |
| 22 |
""" |
| 23 |
And a file named "features/environment.py" with: |
| 24 |
""" |
| 25 |
from behave.tag_matcher import ActiveTagMatcher, setup_active_tag_values |
| 26 |
import sys |
| 27 |
|
| 28 |
# -- ACTIVE TAG SUPPORT: @use.with_{category}={value}, ... |
| 29 |
active_tag_value_provider = { |
| 30 |
"browser": "chrome", |
| 31 |
"webserver": "apache", |
| 32 |
} |
| 33 |
active_tag_matcher = ActiveTagMatcher(active_tag_value_provider) |
| 34 |
|
| 35 |
def before_all(context): |
| 36 |
setup_active_tag_values(active_tag_value_provider, context.config.userdata) |
| 37 |
|
| 38 |
def before_scenario(context, scenario): |
| 39 |
if active_tag_matcher.should_exclude_with(scenario.effective_tags): |
| 40 |
sys.stdout.write("ACTIVE-TAG DISABLED: Scenario %s\n" % scenario.name) |
| 41 |
scenario.skip(active_tag_matcher.exclude_reason) |
| 42 |
""" |
| 43 |
And a file named "behave.ini" with: |
| 44 |
""" |
| 45 |
[behave] |
| 46 |
default_format = pretty |
| 47 |
show_timings = no |
| 48 |
show_skipped = no |
| 49 |
color = no |
| 50 |
""" |
| 51 |
And a file named "features/outline.active_tags.feature" with: |
| 52 |
""" |
| 53 |
Feature: |
| 54 |
|
| 55 |
@use.with_browser=chrome |
| 56 |
Scenario Outline: Alice -- <name>, <language> |
| 57 |
Given a step passes |
| 58 |
But note that "<name> can speak <language>" |
| 59 |
|
| 60 |
Examples: |
| 61 |
| name | language | |
| 62 |
| Anna | German | |
| 63 |
| Arabella | English | |
| 64 |
""" |
| 65 |
|
| 66 |
|
| 67 |
Scenario: ScenarioOutline with enabled active-tag is executed |
| 68 |
When I run "behave -D browser=chrome features/outline.active_tags.feature" |
| 69 |
Then it should pass with: |
| 70 |
""" |
| 71 |
2 scenarios passed, 0 failed, 0 skipped |
| 72 |
4 steps passed, 0 failed, 0 skipped, 0 undefined |
| 73 |
""" |
| 74 |
And the command output should contain: |
| 75 |
""" |
| 76 |
@use.with_browser=chrome |
| 77 |
Scenario Outline: Alice -- Anna, German -- @1.1 # features/outline.active_tags.feature:10 |
| 78 |
Given a step passes # features/steps/pass_steps.py:3 |
| 79 |
But note that "Anna can speak German" # ../behave4cmd0/note_steps.py:15 |
| 80 |
|
| 81 |
@use.with_browser=chrome |
| 82 |
Scenario Outline: Alice -- Arabella, English -- @1.2 # features/outline.active_tags.feature:11 |
| 83 |
Given a step passes # features/steps/pass_steps.py:3 |
| 84 |
But note that "Arabella can speak English" # ../behave4cmd0/note_steps.py:15 |
| 85 |
""" |
| 86 |
And the command output should not contain "ACTIVE-TAG DISABLED: Scenario Alice" |
| 87 |
But note that "we check now for the specific syndrome" |
| 88 |
And the command output should not contain "@use.with_browserchrome" |
| 89 |
But the command output should contain "@use.with_browser=chrome" |
| 90 |
|
| 91 |
|
| 92 |
Scenario: ScenarioOutline with disabled active-tag is skipped |
| 93 |
When I run "behave -D browser=other features/outline.active_tags.feature" |
| 94 |
Then it should pass with: |
| 95 |
""" |
| 96 |
0 scenarios passed, 0 failed, 2 skipped |
| 97 |
0 steps passed, 0 failed, 4 skipped, 0 undefined |
| 98 |
""" |
| 99 |
And the command output should contain: |
| 100 |
""" |
| 101 |
ACTIVE-TAG DISABLED: Scenario Alice -- Anna, German -- @1.1 |
| 102 |
ACTIVE-TAG DISABLED: Scenario Alice -- Arabella, English -- @1.2 |
| 103 |
""" |