Debian Codegraph @

issue.features/issue0063.feature

raw
1 @issue
2 Feature: Issue #63: 'ScenarioOutline' object has no attribute 'stdout'
3
4 The problem occurs when "behave --junit ..." is used
5 And a feature contains one or more ScenarioOutline(s).
6
7 Background: Test Setup
8 Given a new working directory
9 And a file named "features/steps/steps.py" with:
10 """
11 # -- OMIT: from __future__ import print_function
12 from behave import given
13 import sys
14
15 def generate_output(step, outcome, name):
16 # -- OMIT: print("{0}0 {1}: {2};".format(step, outcome, name))
17 sys.stdout.write("{0}1 {1}: {2};\n".format(step, outcome, name))
18 sys.stderr.write("{0}2 {1}: {2};\n".format(step, outcome, name))
19
20 @given(u'a {outcome} step with "{name}"')
21 def step(context, outcome, name):
22 context.name = name
23 generate_output("Given", outcome, name)
24 assert outcome == "passing"
25
26 @when(u'a {outcome} step with "{name}" occurs')
27 def step(context, outcome, name):
28 generate_output("When", outcome, name)
29 assert outcome == "passing"
30
31 @then(u'a {outcome} step with "{name}" is reached')
32 def step(context, outcome, name):
33 generate_output("Then", outcome, name)
34 assert outcome == "passing"
35 assert context.name == name
36 """
37
38 Scenario: ScenarioOutline with Passing Steps
39 Given a file named "features/issue63_case1.feature" with:
40 """
41 Feature: ScenarioOutline with Passing Steps
42 Scenario Outline:
43 Given a passing step with "<name>"
44 When a passing step with "<name>" occurs
45 Then a passing step with "<name>" is reached
46
47 Examples:
48 |name |
49 |Alice|
50 |Bob |
51 """
52 When I run "behave -c --junit features/issue63_case1.feature"
53 Then it should pass with:
54 """
55 2 scenarios passed, 0 failed, 0 skipped
56 6 steps passed, 0 failed, 0 skipped, 0 undefined
57 """
58 But the command output should not contain:
59 """
60 AttributeError: 'ScenarioOutline' object has no attribute 'stdout'
61 """
62
63 Scenario: ScenarioOutline with Passing and Failing Steps
64 Given a file named "features/issue63_case2.feature" with:
65 """
66 Feature: ScenarioOutline with Passing and Failing Steps
67 Scenario Outline:
68 Given a passing step with "<name>"
69 When a failing step with "<name>" occurs
70 Then a passing step with "<name>" is reached
71
72 Examples:
73 |name |
74 |Alice|
75 |Bob |
76 """
77 When I run "behave -c --junit features/issue63_case2.feature"
78 Then it should fail with:
79 """
80 0 scenarios passed, 2 failed, 0 skipped
81 2 steps passed, 2 failed, 2 skipped, 0 undefined
82 """
83 But the command output should not contain:
84 """
85 AttributeError: 'ScenarioOutline' object has no attribute 'stdout'
86 """
87 And the command output should not contain:
88 """
89 AttributeError: 'Scenario' object has no attribute 'exception'
90 """
91 And the command output should contain:
92 """
93 Captured stdout:
94 Given1 passing: Alice;
95 When1 failing: Alice;
96 """
97 And the command output should contain:
98 """
99 Captured stderr:
100 Given2 passing: Alice;
101 When2 failing: Alice;
102 """