forked from cucumber/cucumber-ruby
/
junit_formatter.feature
164 lines (136 loc) · 6.1 KB
/
junit_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
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
Feature: JUnit output formatter
In order for developers to create test reports with ant
Cucumber should be able to output JUnit xml files
Background:
Given I am in junit
And the tmp directory is empty
Scenario: one feature, one passing scenario, one failing scenario
When I run cucumber --format junit --out tmp/ features/one_passing_one_failing.feature
Then it should fail with
"""
"""
And "fixtures/junit/tmp/TEST-features-one_passing_one_failing.xml" with junit duration "0.005" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="1" name="One passing scenario, one failing scenario" skipped="0" tests="2" time="0.005">
<testcase classname="One passing scenario, one failing scenario.Passing" name="Passing" time="0.005">
</testcase>
<testcase classname="One passing scenario, one failing scenario.Failing" name="Failing" time="0.005">
<failure message="failed Failing" type="failed">
<![CDATA[Scenario: Failing
Given a failing scenario
Message:
]]>
<![CDATA[ (RuntimeError)
features/one_passing_one_failing.feature:7:in `Given a failing scenario']]>
</failure>
</testcase>
</testsuite>
"""
Scenario: one feature in a subdirectory, one passing scenario, one failing scenario
When I run cucumber --format junit --out tmp/ features/some_subdirectory/one_passing_one_failing.feature --require features
Then it should fail with
"""
"""
And "fixtures/junit/tmp/TEST-features-some_subdirectory-one_passing_one_failing.xml" with junit duration "0.005" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="1" name="Subdirectory - One passing scenario, one failing scenario" skipped="0" tests="2" time="0.005">
<testcase classname="Subdirectory - One passing scenario, one failing scenario.Passing" name="Passing" time="0.005">
</testcase>
<testcase classname="Subdirectory - One passing scenario, one failing scenario.Failing" name="Failing" time="0.005">
<failure message="failed Failing" type="failed">
<![CDATA[Scenario: Failing
Given a failing scenario
Message:
]]>
<![CDATA[ (RuntimeError)
features/some_subdirectory/one_passing_one_failing.feature:7:in `Given a failing scenario']]>
</failure>
</testcase>
</testsuite>
"""
Scenario: pending and undefined steps are reported as skipped
When I run cucumber --format junit --out tmp/ features/pending.feature
Then it should pass with
"""
"""
And "fixtures/junit/tmp/TEST-features-pending.xml" with junit duration "0.009" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" name="Pending step" skipped="2" tests="2" time="0.009">
<testcase classname="Pending step.Pending" name="Pending" time="0.009">
<skipped/>
</testcase>
<testcase classname="Pending step.Undefined" name="Undefined" time="0.009">
<skipped/>
</testcase>
</testsuite>
"""
Scenario: pending and undefined steps with strict option should fail
When I run cucumber --format junit --out tmp/ features/pending.feature --strict
Then it should fail with
"""
"""
And "fixtures/junit/tmp/TEST-features-pending.xml" with junit duration "0.000160" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="2" name="Pending step" skipped="0" tests="2" time="0.000160">
<testcase classname="Pending step.Pending" name="Pending" time="0.000160">
<failure message="pending Pending" type="pending">
<![CDATA[Scenario: Pending
]]>
<![CDATA[TODO (Cucumber::Pending)
features/pending.feature:4:in `Given a pending step']]>
</failure>
</testcase>
<testcase classname="Pending step.Undefined" name="Undefined" time="0.000160">
<failure message="undefined Undefined" type="undefined">
<![CDATA[Scenario: Undefined
]]>
<![CDATA[Undefined step: "an undefined step" (Cucumber::Undefined)
features/pending.feature:7:in `Given an undefined step']]>
</failure>
</testcase>
</testsuite>
"""
Scenario: run all features
When I run cucumber --format junit --out tmp/ features
Then it should fail with
"""
"""
And "fixtures/junit/tmp/TEST-features-one_passing_one_failing.xml" should exist
And "fixtures/junit/tmp/TEST-features-pending.xml" should exist
Scenario: show correct error message if no --out is passed
When I run cucumber --format junit features
Then STDERR should not match
"""
can't convert .* into String \(TypeError\)
"""
And STDERR should match
"""
You \*must\* specify \-\-out DIR for the junit formatter
"""
Scenario: one feature, one scenario outline, two examples: one passing, one failing
When I run cucumber --format junit --out tmp/ features/scenario_outline.feature
Then it should fail with
"""
"""
And "fixtures/junit/tmp/TEST-features-scenario_outline.xml" with junit duration "0.005" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="1" name="Scenario outlines" skipped="0" tests="2" time="0.005">
<testcase classname="Scenario outlines.Using scenario outlines" name="Using scenario outlines (outline example : | passing |)" time="0.005">
</testcase>
<testcase classname="Scenario outlines.Using scenario outlines" name="Using scenario outlines (outline example : | failing |)" time="0.005">
<failure message="failed Using scenario outlines (outline example : | failing |)" type="failed">
<![CDATA[Scenario Outline: Using scenario outlines
Example row: | failing |
Message:
]]>
<![CDATA[ (RuntimeError)
features/scenario_outline.feature:4:in `Given a <type> scenario']]>
</failure>
</testcase>
</testsuite>
"""