Debian Codegraph @

issue.features/issue0231.feature

raw
1 @issue
2 @not_reproducible
3 Feature: Issue #231: Display the output of the last print command
4
5 . The output of the last print command in a step is not displayed
6 . in the behave output (at least with standard pretty formatter),
7 . unless the string to print ends with newline ('\n').
8 .
9 . ANALYSIS: NOT-REPRODUCIBLE
10 . Checked print function and stdout without newline.
11 . Both show the expected capture stdout output when the step fails.
12
13 @setup
14 Scenario: Feature Setup
15 Given a new working directory
16 And a file named "features/syndrome1.feature" with:
17 """
18 Feature:
19 Scenario: Alice
20 Given a step passes
21 When a step passes
22 Then I write "ALICE was HERE" without newline to stdout and fail
23 """
24 And a file named "features/syndrome2.feature" with:
25 """
26 Feature:
27 Scenario: Bob
28 Given a step passes
29 Then I print "BOB was HERE" without newline and fail
30 """
31 And a file named "features/steps/steps.py" with:
32 """
33 from __future__ import print_function
34 from behave import step
35 import sys
36
37 @step('{word:w} step passes')
38 def step_passes(context, word):
39 pass
40
41 @step('I write "{message}" without newline to stdout and fail')
42 def step_write_without_newline_and_fail(context, message):
43 sys.stdout.write(message)
44 assert False, "FAIL: "+ message
45
46 @step('I print "{message}" without newline and fail')
47 def step_print_without_newline_and_fail(context, message):
48 print(message, end="")
49 assert False, "FAIL: "+ message
50 """
51
52
53 Scenario: Write to stdout without newline
54 When I run "behave -f pretty -c -T features/syndrome1.feature"
55 Then it should fail with:
56 """
57 0 scenarios passed, 1 failed, 0 skipped
58 2 steps passed, 1 failed, 0 skipped, 0 undefined
59 """
60 And the command output should contain:
61 """
62 Captured stdout:
63 ALICE was HERE
64 """
65
66 Scenario: Use print function without newline
67 When I run "behave -f pretty -c -T features/syndrome2.feature"
68 Then it should fail with:
69 """
70 0 scenarios passed, 1 failed, 0 skipped
71 1 step passed, 1 failed, 0 skipped, 0 undefined
72 """
73 And the command output should contain:
74 """
75 Captured stdout:
76 BOB was HERE
77 """