Skip to content

Commit 869f1b1

Browse files
committed
Also write steps for passing tests
1 parent b16361a commit 869f1b1

File tree

9 files changed

+93
-21
lines changed

9 files changed

+93
-21
lines changed

java/src/main/java/io/cucumber/junitxmlformatter/XmlReportWriter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private void writeTestcase(XMLStreamWriter writer, String id) throws XMLStreamEx
7878
writeTestCaseAttributes(writer, id);
7979

8080
writeNonPassedElement(writer, id);
81-
81+
writeStepAndResultList(writer, id);
8282
writer.writeEndElement();
8383
newLine(writer);
8484
}
@@ -109,7 +109,6 @@ private void writeNonPassedElement(XMLStreamWriter writer, String id) throws XML
109109
} else {
110110
writer.writeEmptyElement(elementName);
111111
}
112-
writeStepAndResultList(writer, id);
113112
}
114113

115114
private void writeStepAndResultList(XMLStreamWriter writer, String id) throws XMLStreamException {

testdata/attachments.feature.xml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuite name="Cucumber" time="0.043" tests="7" skipped="0" failures="0" errors="0">
3-
<testcase classname="Attachments" name="Strings can be attached with a media type" time="0.005"></testcase>
4-
<testcase classname="Attachments" name="Log JSON" time="0.005"></testcase>
5-
<testcase classname="Attachments" name="Log text" time="0.005"></testcase>
6-
<testcase classname="Attachments" name="Log ANSI coloured text" time="0.005"></testcase>
7-
<testcase classname="Attachments" name="Byte arrays are base64-encoded regardless of media type" time="0.005"></testcase>
8-
<testcase classname="Attachments" name="Streams are always base64-encoded" time="0.005"></testcase>
9-
<testcase classname="Attachments" name="Attaching images in examples" time="0.005"></testcase>
3+
<testcase classname="Attachments" name="Strings can be attached with a media type" time="0.005"><system-out><![CDATA[
4+
When the string "hello" is attached as "application/octet-stream"...........passed
5+
]]></system-out>
6+
</testcase>
7+
<testcase classname="Attachments" name="Log JSON" time="0.005"><system-out><![CDATA[
8+
When the following string is attached as "application/json":................passed
9+
]]></system-out>
10+
</testcase>
11+
<testcase classname="Attachments" name="Log text" time="0.005"><system-out><![CDATA[
12+
When the string "hello" is logged...........................................passed
13+
]]></system-out>
14+
</testcase>
15+
<testcase classname="Attachments" name="Log ANSI coloured text" time="0.005"><system-out><![CDATA[
16+
When text with ANSI escapes is logged.......................................passed
17+
]]></system-out>
18+
</testcase>
19+
<testcase classname="Attachments" name="Byte arrays are base64-encoded regardless of media type" time="0.005"><system-out><![CDATA[
20+
When an array with 10 bytes is attached as "text/plain".....................passed
21+
]]></system-out>
22+
</testcase>
23+
<testcase classname="Attachments" name="Streams are always base64-encoded" time="0.005"><system-out><![CDATA[
24+
When a JPEG image is attached...............................................passed
25+
]]></system-out>
26+
</testcase>
27+
<testcase classname="Attachments" name="Attaching images in examples" time="0.005"><system-out><![CDATA[
28+
When the cucumber.png png is attached.......................................passed
29+
]]></system-out>
30+
</testcase>
1031
</testsuite>

testdata/data-tables.feature.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuite name="Cucumber" time="0.007" tests="1" skipped="0" failures="0" errors="0">
3-
<testcase classname="Data Tables" name="transposed table" time="0.005"></testcase>
3+
<testcase classname="Data Tables" name="transposed table" time="0.005"><system-out><![CDATA[
4+
When the following table is transposed:.....................................passed
5+
Then it should be:..........................................................passed
6+
]]></system-out>
7+
</testcase>
48
</testsuite>

testdata/examples-tables.feature.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuite name="Cucumber" time="0.049" tests="6" skipped="0" failures="4" errors="0">
3-
<testcase classname="Examples Tables" name="eating cucumbers" time="0.007"></testcase>
4-
<testcase classname="Examples Tables" name="eating cucumbers" time="0.007"></testcase>
3+
<testcase classname="Examples Tables" name="eating cucumbers" time="0.007"><system-out><![CDATA[
4+
Given there are 12 cucumbers................................................passed
5+
When I eat 5 cucumbers......................................................passed
6+
Then I should have 7 cucumbers..............................................passed
7+
]]></system-out>
8+
</testcase>
9+
<testcase classname="Examples Tables" name="eating cucumbers" time="0.007"><system-out><![CDATA[
10+
Given there are 20 cucumbers................................................passed
11+
When I eat 5 cucumbers......................................................passed
12+
Then I should have 15 cucumbers.............................................passed
13+
]]></system-out>
14+
</testcase>
515
<testcase classname="Examples Tables" name="eating cucumbers" time="0.007">
616
<failure>
717
<![CDATA[Expected values to be strictly equal:

testdata/markdown.feature.md.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@ When we use a data table and attach something and then fail.................fail
1313
Then this might or might not run............................................skipped
1414
]]></system-out>
1515
</testcase>
16-
<testcase classname="Cheese" name="Ylajali!" time="0.009"></testcase>
16+
<testcase classname="Cheese" name="Ylajali!" time="0.009"><system-out><![CDATA[
17+
Given some TypeScript code:.................................................passed
18+
And some classic Gherkin:...................................................passed
19+
When we use a data table and attach something and then pass.................passed
20+
Then this might or might not run............................................passed
21+
]]></system-out>
22+
</testcase>
1723
</testsuite>

testdata/minimal.feature.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuite name="Cucumber" time="0.005" tests="1" skipped="0" failures="0" errors="0">
3-
<testcase classname="minimal" name="cukes" time="0.003"></testcase>
3+
<testcase classname="minimal" name="cukes" time="0.003"><system-out><![CDATA[
4+
Given I have 42 cukes in my belly...........................................passed
5+
]]></system-out>
6+
</testcase>
47
</testsuite>

testdata/parameter-types.feature.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuite name="Cucumber" time="0.005" tests="1" skipped="0" failures="0" errors="0">
3-
<testcase classname="Parameter Types" name="flights" time="0.003"></testcase>
3+
<testcase classname="Parameter Types" name="flights" time="0.003"><system-out><![CDATA[
4+
Given LHR-CDG has been delayed 45 minutes...................................passed
5+
]]></system-out>
6+
</testcase>
47
</testsuite>

testdata/retry.feature.xml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuite name="Cucumber" time="0.041" tests="10" skipped="0" failures="7" errors="0">
3-
<testcase classname="Retry" name="test case passes on the first attempt" time="0.003"></testcase>
3+
<testcase classname="Retry" name="test case passes on the first attempt" time="0.003"><system-out><![CDATA[
4+
Given a step that always passes.............................................passed
5+
]]></system-out>
6+
</testcase>
47
<testcase classname="Retry" name="test case passes on the second attempt" time="0.003">
58
<failure>
69
<![CDATA[Exception in step
@@ -10,7 +13,10 @@ samples/retry/retry.feature:13]]>
1013
Given a step that passes the second time....................................passed
1114
]]></system-out>
1215
</testcase>
13-
<testcase classname="Retry" name="test case passes on the second attempt" time="0.003"></testcase>
16+
<testcase classname="Retry" name="test case passes on the second attempt" time="0.003"><system-out><![CDATA[
17+
Given a step that passes the second time....................................passed
18+
]]></system-out>
19+
</testcase>
1420
<testcase classname="Retry" name="test case passes on the final attempt" time="0.003">
1521
<failure>
1622
<![CDATA[Exception in step
@@ -29,7 +35,10 @@ samples/retry/retry.feature:16]]>
2935
Given a step that passes the third time.....................................passed
3036
]]></system-out>
3137
</testcase>
32-
<testcase classname="Retry" name="test case passes on the final attempt" time="0.003"></testcase>
38+
<testcase classname="Retry" name="test case passes on the final attempt" time="0.003"><system-out><![CDATA[
39+
Given a step that passes the third time.....................................passed
40+
]]></system-out>
41+
</testcase>
3342
<testcase classname="Retry" name="test case fails on every attempt" time="0.003">
3443
<failure>
3544
<![CDATA[Exception in step

testdata/rules.feature.xml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuite name="Cucumber" time="0.029" tests="3" skipped="0" failures="0" errors="0">
3-
<testcase classname="Rules" name="no change" time="0.007"></testcase>
4-
<testcase classname="Rules" name="exact change" time="0.009"></testcase>
5-
<testcase classname="Rules" name="no chocolates left" time="0.009"></testcase>
3+
<testcase classname="Rules" name="no change" time="0.007"><system-out><![CDATA[
4+
Given there are 5 0.20 coins inside.........................................passed
5+
When the customer tries to buy a 0.85 chocolate with a 1 coin...............passed
6+
Then the sale should not happen.............................................passed
7+
]]></system-out>
8+
</testcase>
9+
<testcase classname="Rules" name="exact change" time="0.009"><system-out><![CDATA[
10+
Given there are 5 0.20 coins inside.........................................passed
11+
And there are 3 chocolates inside...........................................passed
12+
When the customer tries to buy a 0.80 chocolate with a 1 coin...............passed
13+
Then the customer's change should be 1 0.20 coin............................passed
14+
]]></system-out>
15+
</testcase>
16+
<testcase classname="Rules" name="no chocolates left" time="0.009"><system-out><![CDATA[
17+
Given there are no chocolates inside........................................passed
18+
But there are 10 0.5 coins inside...........................................passed
19+
When the customer tries to buy a 0.85 chocolate with a 1 coin...............passed
20+
Then the sale should not happen.............................................passed
21+
]]></system-out>
22+
</testcase>
623
</testsuite>

0 commit comments

Comments
 (0)