forked from cucumber/cucumber-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rerun_formatter.feature
127 lines (104 loc) · 3.47 KB
/
rerun_formatter.feature
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
Feature: Rerun Formatter
In order to allow users to easily run only the failing scenarios
Users can save the rerun formatter's output to a file and pass it as an argument on the next run
Background:
Given a file named "features/a.feature" with:
"""
Feature: A
Scenario: 1
Given a passing step
Scenario: 2
Given a failing step
Scenario: 3
Given a failing step
"""
And a file named "features/b.feature" with:
"""
Feature: B
Scenario: 4
Given a passing step
Scenario: 5
Given a failing step
"""
And a file named "features/step_definitions/cucumber_steps.js" with:
"""
var cucumberSteps = function() {
this.When(/^a passing step$/, function() { });
this.When(/^a failing step$/, function() { throw 'fail' });
};
module.exports = cucumberSteps;
"""
And a file named "cucumber.js" with:
"""
module.exports = {
'default': '--format rerun:@rerun.txt',
};
"""
Scenario: passing
When I run cucumber.js with `features/a.feature:2`
Then it outputs this text:
"""
Feature: A
Scenario: 1 # features/a.feature:2
Given a passing step # features/step_definitions/cucumber_steps.js:2
1 scenario (1 passed)
1 step (1 passed)
<duration-stat>
"""
And the file "@rerun.txt" has the text:
"""
"""
Scenario: multiple scenarios failing
When I run cucumber.js
Then it outputs this text:
"""
Feature: A
Scenario: 1 # features/a.feature:2
Given a passing step # features/step_definitions/cucumber_steps.js:2
Scenario: 2 # features/a.feature:5
Given a failing step # features/step_definitions/cucumber_steps.js:3
fail
Scenario: 3 # features/a.feature:8
Given a failing step # features/step_definitions/cucumber_steps.js:3
fail
Feature: B
Scenario: 4 # features/b.feature:2
Given a passing step # features/step_definitions/cucumber_steps.js:2
Scenario: 5 # features/b.feature:5
Given a failing step # features/step_definitions/cucumber_steps.js:3
fail
Failing scenarios:
features/a.feature:5 # Scenario: 2
features/a.feature:8 # Scenario: 3
features/b.feature:5 # Scenario: 5
5 scenarios (3 failed, 2 passed)
5 steps (3 failed, 2 passed)
<duration-stat>
"""
And the file "@rerun.txt" has the text:
"""
features/a.feature:5:8
features/b.feature:5
"""
When I run cucumber.js with `@rerun.txt`
Then it outputs this text:
"""
Feature: A
Scenario: 2 # features/a.feature:5
Given a failing step # features/step_definitions/cucumber_steps.js:3
fail
Scenario: 3 # features/a.feature:8
Given a failing step # features/step_definitions/cucumber_steps.js:3
fail
Feature: B
Scenario: 5 # features/b.feature:5
Given a failing step # features/step_definitions/cucumber_steps.js:3
fail
Failing scenarios:
features/a.feature:5 # Scenario: 2
features/a.feature:8 # Scenario: 3
features/b.feature:5 # Scenario: 5
3 scenarios (3 failed)
3 steps (3 failed)
<duration-stat>
"""