Debian Codegraph @

issue.features/issue0188.feature

raw
1 @issue
2 Feature: Issue #188: Better diagnostics if nested step is undefined
3
4 . Currently if nested step has no match, it's shown like this:
5 .
6 . Assertion Failed: Sub-step failed: When I do strange thign
7 . Substep info: None
8 .
9 . Took some time to find that typo.
10 . The suggestion is to fill substep error_message with at least "No match for step"
11 . so it would become:
12 .
13 . Assertion Failed: Sub-step failed: When I do strange thign
14 . Substep info: No match for step
15 .
16 . IMPLEMENTATION NOTE:
17 . A slightly different output is provided:
18 .
19 . Assertion Failed: UNDEFINED SUB-STEP: When I do strange thign
20
21
22 Scenario: Nested steps contain an undefined step
23 Given a new working directory
24 And a file named "features/steps/steps.py" with:
25 """
26 from behave import step
27
28 @step('{word:w} step passes')
29 def step_passes(context, word):
30 pass
31
32 @then('a good diagnostic message is shown')
33 def step_good_diagnostic_message_is_shown(context):
34 pass
35
36 @step('I execute nested steps with an undefined step')
37 def step_passes(context):
38 context.execute_steps(u'''
39 Given another step passes
40 When an undefined, nested step is executed
41 Then third step passes
42 ''')
43 """
44 And a file named "features/example.execute_nested_undefined_step.feature" with:
45 """
46 Feature:
47 Scenario:
48 Given a step passes
49 When I execute nested steps with an undefined step
50 Then a good diagnostic message is shown
51 """
52 When I run "behave -f plain -T features/example.execute_nested_undefined_step.feature"
53 Then it should fail with:
54 """
55 Scenario:
56 Given a step passes ... passed
57 When I execute nested steps with an undefined step ... failed
58 Assertion Failed: UNDEFINED SUB-STEP: When an undefined, nested step is executed
59 """
60