1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
@issue
Feature: Issue #41 Missing Steps are duplicated in a Scenario Outline
As I user
I want that missing steps are reported only once.
Background: Test Setup
Given a new working directory
And a file named "features/steps/steps.py" with:
"""
from behave import given, when, then
@given(u'I enter a "{name}"')
def step(context, name):
context.name = name
@when(u'I enter a "{name}"')
def step(context, name):
context.name = name
@then(u'the name is "{name}"')
def step(context, name):
assert context.name == name
"""
Scenario: Missing Given Step
Given a file named "features/issue41_missing1.feature" with:
"""
Feature: Missing Given-Step in a Scenario Outline
Scenario Outline:
Given an unknown step
When I enter a "<name>"
Then the name is "<name>"
Examples:
|name |
|Alice|
|Bob |
"""
When I run "behave -c -f plain features/issue41_missing1.feature"
Then it should fail with:
"""
0 steps passed, 0 failed, 4 skipped, 2 undefined
"""
And the command output should contain:
"""
You can implement step definitions for undefined steps with these snippets:
@given(u'an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: Given an unknown step')
"""
But the command output should not contain:
"""
You can implement step definitions for undefined steps with these snippets:
@given(u'an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: Given an unknown step')
@given(u'an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: Given an unknown step')
"""
Scenario: Missing When Step
Given a file named "features/issue41_missing2.feature" with:
"""
Feature: Missing When-Step in a Scenario Outline
Scenario Outline:
Given I enter a "<name>"
When I use an unknown step
Then the name is "<name>"
Examples:
|name |
|Alice|
|Bob |
"""
When I run "behave -c -f plain features/issue41_missing2.feature"
Then it should fail with:
"""
2 steps passed, 0 failed, 2 skipped, 2 undefined
"""
And the command output should contain:
"""
You can implement step definitions for undefined steps with these snippets:
@when(u'I use an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: When I use an unknown step')
"""
But the command output should not contain:
"""
You can implement step definitions for undefined steps with these snippets:
@when(u'I use an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: When I use an unknown step')
@when(u'I use an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: When I use an unknown step')
"""
Scenario: Missing Then Step
Given a file named "features/issue41_missing3.feature" with:
"""
Feature: Missing Then-Step in a Scenario Outline
Scenario Outline:
Given I enter a "<name>"
When I enter a "<name>"
Then I use an unknown step
Examples:
|name |
|Alice|
|Bob |
"""
When I run "behave -c -f plain features/issue41_missing3.feature"
Then it should fail with:
"""
4 steps passed, 0 failed, 0 skipped, 2 undefined
"""
And the command output should contain:
"""
You can implement step definitions for undefined steps with these snippets:
@then(u'I use an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: Then I use an unknown step')
"""
But the command output should not contain:
"""
You can implement step definitions for undefined steps with these snippets:
@then(u'I use an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: Then I use an unknown step')
@then(u'I use an unknown step')
def step_impl(context):
raise NotImplementedError(u'STEP: Then I use an unknown step')
"""
|