File: formatter.progress3.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 (235 lines) | stat: -rw-r--r-- 10,101 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
@sequential
Feature: Progress3 Formatter

    In order to effectively analyze output of many runs
    As a tester
    I want that behave generates to present results for each scenario

    @setup
    Scenario: Feature Setup
        Given a new working directory
        And a file named "features/steps/steps.py" with:
            """
            from behave import step

            @step('{word:w} step passes')
            def step_passes(context, word):
                pass

            @step('{word:w} step fails')
            def step_fails(context, word):
                assert False, "XFAIL-STEP"

            @step(u'a step raises an error "{message}"')
            def step_raises_exception(context, message):
                raise RuntimeError(message)
            """

    Scenario: Use Progress3 formatter on simple feature
        Given a file named "features/simple_feature_with_name.feature" with:
            """
            Feature: Simple, empty Feature
            """
        When I run "behave -f progress3 features/simple_feature_with_name.feature"
        Then it should pass with:
            """
            0 features passed, 0 failed, 1 skipped
            0 scenarios passed, 0 failed, 0 skipped
            """
        And the command output should contain:
            """
            Simple, empty Feature    # features/simple_feature_with_name.feature
            """

    Scenario: Use Progress3 formatter with feature and one scenario without steps
        Given a file named "features/simple_scenario.feature" with:
            """
            Feature: Simple feature with one scenario
              Scenario: Simple scenario without steps
            """
        When I run "behave -f progress3 features/simple_scenario.feature"
        Then it should pass with:
            """
            1 feature passed, 0 failed, 0 skipped
            1 scenario passed, 0 failed, 0 skipped
            """
        And the command output should contain:
            """
            Simple feature with one scenario    # features/simple_scenario.feature
              Simple scenario without steps
            """

    Scenario: Use Progress3 formatter with feature and one scenario with all passing steps
        Given a file named "features/scenario_with_steps.feature" with:
            """
            Feature: Feature with scenario
              Scenario: Simple scenario with passing steps
                  Given a step passes
                  When another step passes
                  Then third step passes
                  And fourth step passes
                  But fifth step passes
            """
        When I run "behave -f progress3 features/scenario_with_steps.feature"
        Then it should pass with:
            """
            1 feature passed, 0 failed, 0 skipped
            1 scenario passed, 0 failed, 0 skipped
            """
        And the command output should contain:
            """
            Feature with scenario    # features/scenario_with_steps.feature
              Simple scenario with passing steps  .....
            """

    Scenario: Use Progress3 formatter with feature and one scenario with a failing step
        Given a file named "features/scenario_with_steps.feature" with:
            """
            Feature: Feature with scenario
              Scenario: Simple scenario with last failing step
                  Given a step passes
                  When second step passes
                  Then third step passes
                  And another step passes
                  But last step fails
            """
        When I run "behave -f progress3 features/scenario_with_steps.feature"
        Then it should fail with:
            """
            0 features passed, 1 failed, 0 skipped
            0 scenarios passed, 1 failed, 0 skipped
            """
        And the command output should contain:
            """
            Feature with scenario    # features/scenario_with_steps.feature
                Simple scenario with last failing step  ....F
            --------------------------------------------------------------------------------
            FAILURE in step 'last step fails' (features/scenario_with_steps.feature:7):
            Assertion Failed: XFAIL-STEP
            --------------------------------------------------------------------------------
            """

    Scenario: Use Progress3 formatter with feature and one scenario with an exception in the step
        Given a file named "features/scenario_with_steps.feature" with:
            """
            Feature: Feature with scenario
              Scenario: Simple scenario with error in the step
                  Given a step passes
                  When second step passes
                  Then third step passes
                  And another step passes
                  But a step raises an error "Error message here"
            """
        When I run "behave -f progress3 features/scenario_with_steps.feature"
        Then it should fail with:
            """
            0 features passed, 1 failed, 0 skipped
            0 scenarios passed, 1 failed, 0 skipped
            """
        And the command output should contain:
            """
            Feature with scenario    # features/scenario_with_steps.feature
                Simple scenario with error in the step  ....E
            --------------------------------------------------------------------------------
            FAILURE in step 'a step raises an error "Error message here"' (features/scenario_with_steps.feature:7):
            """
        And the command output should contain:
            """
            RuntimeError: Error message here
            
            --------------------------------------------------------------------------------
            """

    Scenario: Use Progress3 formatter with feature and three scenarios with all passing steps
        Given a file named "features/scenario_with_steps.feature" with:
            """
            Feature: Feature with three scenarios
              Scenario: First scenario with passing steps
                  Given a step passes
                  When second step passes
                  Then third step passes
                  And another step passes
                  But last step passes

              Scenario: Second scenario with passing steps
                  Given a step passes
                  When second step passes
                  Then third step passes
                  And another step passes
                  But last step passes

              Scenario: Third scenario with passing steps
                  Given a step passes
                  When second step passes
                  Then third step passes
                  And another step passes
                  But last step passes
            """
        When I run "behave -f progress3 features/scenario_with_steps.feature"
        Then it should pass with:
            """
            1 feature passed, 0 failed, 0 skipped
            3 scenarios passed, 0 failed, 0 skipped
            15 steps passed, 0 failed, 0 skipped, 0 undefined
            """
        And the command output should contain:
            """
            Feature with three scenarios    # features/scenario_with_steps.feature
                First scenario with passing steps  .....
                Second scenario with passing steps  .....
                Third scenario with passing steps  .....
            """

    Scenario: Use Progress3 formatter with feature and three scenarios with a failing step
        Given a file named "features/scenario_with_steps.feature" with:
            """
            Feature: Feature with various results in scenarios
              Scenario: First scenario with passing steps
                  Given a step passes
                  When second step passes
                  Then third step passes
                  And another step passes
                  But last step passes

              Scenario: Second scenario with second failing step
                  Given a step passes
                  When second step fails
                  Then third step passes
                  And another step passes
                  But last step passes

              Scenario: Third scenario with fourth failing step
                  Given a step passes
                  When second step passes
                  Then third step passes
                  And fourth step fails
                  But last step passes
            """
        When I run "behave -f progress3 features/scenario_with_steps.feature"
        Then it should fail with:
            """
            0 features passed, 1 failed, 0 skipped
            1 scenario passed, 2 failed, 0 skipped
            9 steps passed, 2 failed, 4 skipped, 0 undefined
            """
        And the command output should contain:
            """
            Feature with various results in scenarios    # features/scenario_with_steps.feature
                First scenario with passing steps  .....
                Second scenario with second failing step  .F
            --------------------------------------------------------------------------------
            FAILURE in step 'second step fails' (features/scenario_with_steps.feature:11):
            Assertion Failed: XFAIL-STEP
            --------------------------------------------------------------------------------
            
                Third scenario with fourth failing step  ...F
            --------------------------------------------------------------------------------
            FAILURE in step 'fourth step fails' (features/scenario_with_steps.feature:20):
            Assertion Failed: XFAIL-STEP
            --------------------------------------------------------------------------------
            
            
            Failing scenarios:
              features/scenario_with_steps.feature:9  Second scenario with second failing step
              features/scenario_with_steps.feature:16  Third scenario with fourth failing step
            """