File: issue0063.feature

package info (click to toggle)
behave 1.2.6-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,160 kB
  • sloc: python: 19,857; makefile: 137; sh: 18
file content (102 lines) | stat: -rw-r--r-- 3,350 bytes parent folder | download | duplicates (4)
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
@issue
Feature: Issue #63: 'ScenarioOutline' object has no attribute 'stdout'

  The problem occurs when "behave --junit ..." is used
  And a feature contains one or more ScenarioOutline(s).

  Background: Test Setup
    Given a new working directory
    And   a file named "features/steps/steps.py" with:
      """
      # -- OMIT: from __future__ import print_function
      from behave import given
      import sys

      def generate_output(step, outcome, name):
          # -- OMIT: print("{0}0 {1}: {2};".format(step, outcome, name))
          sys.stdout.write("{0}1 {1}: {2};\n".format(step, outcome, name))
          sys.stderr.write("{0}2 {1}: {2};\n".format(step, outcome, name))

      @given(u'a {outcome} step with "{name}"')
      def step(context, outcome, name):
          context.name = name
          generate_output("Given", outcome, name)
          assert outcome == "passing"

      @when(u'a {outcome} step with "{name}" occurs')
      def step(context, outcome, name):
          generate_output("When", outcome, name)
          assert outcome == "passing"

      @then(u'a {outcome} step with "{name}" is reached')
      def step(context, outcome, name):
          generate_output("Then", outcome, name)
          assert outcome == "passing"
          assert context.name == name
      """

  Scenario: ScenarioOutline with Passing Steps
    Given a file named "features/issue63_case1.feature" with:
      """
      Feature: ScenarioOutline with Passing Steps
        Scenario Outline:
          Given a passing step with "<name>"
          When  a passing step with "<name>" occurs
          Then  a passing step with "<name>" is reached

        Examples:
            |name |
            |Alice|
            |Bob  |
      """
    When I run "behave -c --junit features/issue63_case1.feature"
    Then it should pass with:
      """
      2 scenarios passed, 0 failed, 0 skipped
      6 steps passed, 0 failed, 0 skipped, 0 undefined
      """
    But the command output should not contain:
      """
      AttributeError: 'ScenarioOutline' object has no attribute 'stdout'
      """

  Scenario: ScenarioOutline with Passing and Failing Steps
    Given a file named "features/issue63_case2.feature" with:
      """
      Feature: ScenarioOutline with Passing and Failing Steps
        Scenario Outline:
          Given a passing step with "<name>"
          When  a failing step with "<name>" occurs
          Then  a passing step with "<name>" is reached

        Examples:
            |name |
            |Alice|
            |Bob  |
      """
    When I run "behave -c --junit features/issue63_case2.feature"
    Then it should fail with:
      """
      0 scenarios passed, 2 failed, 0 skipped
      2 steps passed, 2 failed, 2 skipped, 0 undefined
      """
    But the command output should not contain:
      """
      AttributeError: 'ScenarioOutline' object has no attribute 'stdout'
      """
    And the command output should not contain:
      """
      AttributeError: 'Scenario' object has no attribute 'exception'
      """
    And the command output should contain:
      """
      Captured stdout:
      Given1 passing: Alice;
      When1 failing: Alice;
      """
    And the command output should contain:
      """
      Captured stderr:
      Given2 passing: Alice;
      When2 failing: Alice;
      """