Skip to content

Commit c83d85a

Browse files
committed
Include pickle name if parameterized
Include the pickle name in the test name, if the pickle was parameterized. Fixes: #27, properly this time.
1 parent 8e5debe commit c83d85a

File tree

5 files changed

+31
-16
lines changed

5 files changed

+31
-16
lines changed

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ Feature: Rules
7878
```
7979

8080
Likewise for example tables, the rule (if any), scenario outline name, example
81-
name, and number are included.
81+
name, and number are included. Additionally, if the scenario outline name is
82+
parameterized, the pickle name is included too.
8283

8384
```feature
8485
Feature: Examples Tables
@@ -97,13 +98,27 @@ Feature: Examples Tables
9798
| start | eat | left |
9899
| 12 | 20 | 0 |
99100
| 0 | 1 | 0 |
101+
102+
Scenario Outline: Eating <color> cucumbers
103+
Given I am transparent
104+
When I eat <color> cucumbers
105+
Then I become <color>
106+
107+
Examples:
108+
| color |
109+
| red |
110+
| green |
111+
| blue |
100112
```
101113

102114
```xml
103-
<testcase classname="Examples Tables" name="Eating cucumbers - These are passing - Example #1.1" />
104-
<testcase classname="Examples Tables" name="Eating cucumbers - These are passing - Example #1.2" />
105-
<testcase classname="Examples Tables" name="Eating cucumbers - These are failing - Example #2.1" />
106-
<testcase classname="Examples Tables" name="Eating cucumbers - These are failing - Example #2.2" />
115+
<testcase classname="Examples Tables" name="Eating cucumbers - These are passing - #1.1" />
116+
<testcase classname="Examples Tables" name="Eating cucumbers - These are passing - #1.2" />
117+
<testcase classname="Examples Tables" name="Eating cucumbers - These are failing - #2.1" />
118+
<testcase classname="Examples Tables" name="Eating cucumbers - These are failing - #2.2" />
119+
<testcase classname="Examples Tables" name="Eating <color> cucumbers - #1.1: Eating red cucumbers" />
120+
<testcase classname="Examples Tables" name="Eating <color> cucumbers - #1.2: Eating green cucumbers" />
121+
<testcase classname="Examples Tables" name="Eating <color> cucumbers - #1.3: Eating blue cucumbers" />
107122
```
108123
## Contributing
109124

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class MessagesToJunitXmlWriter implements AutoCloseable {
2727
private boolean streamClosed = false;
2828

2929
public MessagesToJunitXmlWriter(OutputStream out) {
30-
this(NamingStrategy.ExampleName.NUMBER, out);
30+
this(NamingStrategy.ExampleName.NUMBER_AND_PICKLE_IF_PARAMETERIZED, out);
3131
}
3232

3333
public MessagesToJunitXmlWriter(NamingStrategy.ExampleName exampleNameStrategy, OutputStream out) {

testdata/attachments.feature.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ When a JPEG image is attached...............................................pass
3535
When a PNG image is attached................................................passed
3636
]]></system-out>
3737
</testcase>
38-
<testcase classname="Attachments" name="Attaching images in an examples table - Example #1.1" time="0.005">
38+
<testcase classname="Attachments" name="Attaching images in an examples table - #1.1" time="0.005">
3939
<system-out><![CDATA[
4040
When a JPEG image is attached...............................................passed
4141
]]></system-out>
4242
</testcase>
43-
<testcase classname="Attachments" name="Attaching images in an examples table - Example #1.2" time="0.005">
43+
<testcase classname="Attachments" name="Attaching images in an examples table - #1.2" time="0.005">
4444
<system-out><![CDATA[
4545
When a PNG image is attached................................................passed
4646
]]></system-out>

testdata/examples-tables.feature.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
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 - These are passing - Example #1.1" time="0.007">
3+
<testcase classname="Examples Tables" name="Eating cucumbers - These are passing - #1.1" time="0.007">
44
<system-out><![CDATA[
55
Given there are 12 cucumbers................................................passed
66
When I eat 5 cucumbers......................................................passed
77
Then I should have 7 cucumbers..............................................passed
88
]]></system-out>
99
</testcase>
10-
<testcase classname="Examples Tables" name="Eating cucumbers - These are passing - Example #1.2" time="0.007">
10+
<testcase classname="Examples Tables" name="Eating cucumbers - These are passing - #1.2" time="0.007">
1111
<system-out><![CDATA[
1212
Given there are 20 cucumbers................................................passed
1313
When I eat 5 cucumbers......................................................passed
1414
Then I should have 15 cucumbers.............................................passed
1515
]]></system-out>
1616
</testcase>
17-
<testcase classname="Examples Tables" name="Eating cucumbers - These are failing - Example #2.1" time="0.007">
17+
<testcase classname="Examples Tables" name="Eating cucumbers - These are failing - #2.1" time="0.007">
1818
<failure type="AssertionError" message="Expected values to be strictly equal:
1919
2020
-8 !== 0
@@ -32,7 +32,7 @@ When I eat 20 cucumbers.....................................................pass
3232
Then I should have 0 cucumbers..............................................failed
3333
]]></system-out>
3434
</testcase>
35-
<testcase classname="Examples Tables" name="Eating cucumbers - These are failing - Example #2.2" time="0.007">
35+
<testcase classname="Examples Tables" name="Eating cucumbers - These are failing - #2.2" time="0.007">
3636
<failure type="AssertionError" message="Expected values to be strictly equal:
3737
3838
-1 !== 0
@@ -50,15 +50,15 @@ When I eat 1 cucumbers......................................................pass
5050
Then I should have 0 cucumbers..............................................failed
5151
]]></system-out>
5252
</testcase>
53-
<testcase classname="Examples Tables" name="Eating cucumbers - These are undefined because the value is not an {int} - Example #3.1" time="0.007">
53+
<testcase classname="Examples Tables" name="Eating cucumbers - These are undefined because the value is not an {int} - #3.1" time="0.007">
5454
<failure/>
5555
<system-out><![CDATA[
5656
Given there are 12 cucumbers................................................passed
5757
When I eat banana cucumbers.................................................undefined
5858
Then I should have 12 cucumbers.............................................skipped
5959
]]></system-out>
6060
</testcase>
61-
<testcase classname="Examples Tables" name="Eating cucumbers - These are undefined because the value is not an {int} - Example #3.2" time="0.007">
61+
<testcase classname="Examples Tables" name="Eating cucumbers - These are undefined because the value is not an {int} - #3.2" time="0.007">
6262
<failure/>
6363
<system-out><![CDATA[
6464
Given there are 0 cucumbers.................................................passed

testdata/markdown.feature.md.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<testsuite name="Cucumber" time="0.021" tests="2" skipped="0" failures="1" errors="0">
3-
<testcase classname="Cheese" name="Nom nom nom - Ylajali! - because we need more tables - Example #1.1" time="0.009">
3+
<testcase classname="Cheese" name="Nom nom nom - Ylajali! - because we need more tables - #1.1" time="0.009">
44
<failure type="Error" message="You asked me to fail">
55
<![CDATA[You asked me to fail
66
samples/markdown/markdown.feature.md:24
@@ -13,7 +13,7 @@ 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="Nom nom nom - Ylajali! - because we need more tables - Example #1.2" time="0.009">
16+
<testcase classname="Cheese" name="Nom nom nom - Ylajali! - because we need more tables - #1.2" time="0.009">
1717
<system-out><![CDATA[
1818
Given some TypeScript code:.................................................passed
1919
And some classic Gherkin:...................................................passed

0 commit comments

Comments
 (0)