Debian Codegraph @

issue.features/issue0424.feature

raw
1 @issue
2 @unicode
3 Feature: Issue #424 -- Unicode output problem when fails in nested steps
4
5 . HINTS:
6 . * Python step file should have encoding line (# -*- coding: ... -*-)
7 . * Assert failure message should use unicode-string instead of byte-string
8
9 Scenario:
10 Given a new working directory
11 And a file named "features/steps/pass_steps.py" with:
12 """
13 from behave import step
14
15 @step('{word:w} step passes')
16 def step_passes(context, word):
17 pass
18 """
19 And a file named "features/steps/steps.py" with:
20 """
21 # -*- coding: UTF-8 -*-
22 # NOTE: Python2 requires encoding to decode special chars correctly.
23 from behave import step
24
25 @step('I press the big red button')
26 def step_press_red_button(context):
27 assert False, u"Ungültiger Wert" # HINT: Special chars require Unicode.
28
29 @step('I call the nested step with the "red button"')
30 def step_press_red_button(context):
31 context.execute_steps(u'When I press the big red button')
32 """
33 And a file named "behave.ini" with:
34 """
35 [behave]
36 show_timings = false
37 """
38 And a file named "features/alice.feature" with:
39 """
40 Feature:
41
42 Scenario: Use step directly
43 When I press the big red button
44
45 Scenario: Use nested step
46 Given another step passes
47 When I call the nested step with the "red button"
48 """
49 When I run "behave -f plain features/alice.feature"
50 Then it should fail with:
51 """
52 0 scenarios passed, 2 failed, 0 skipped
53 1 step passed, 2 failed, 0 skipped, 0 undefined
54 """
55 And the command output should contain:
56 """
57 Scenario: Use step directly
58 When I press the big red button ... failed
59 Assertion Failed: Ungültiger Wert
60
61 Scenario: Use nested step
62 Given another step passes ... passed
63 When I call the nested step with the "red button" ... failed
64 Assertion Failed: FAILED SUB-STEP: When I press the big red button
65 Substep info: Assertion Failed: Ungültiger Wert
66 """