Skip to content

Commit af58833

Browse files
authored
Include pickle name if parameterized (#4)
Include the pickle name in the test name, if the pickle was parameterized.
1 parent de83ce9 commit af58833

File tree

10 files changed

+164
-99
lines changed

10 files changed

+164
-99
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Changed
10+
- Include pickle name if parameterized [#4](https://github.com/cucumber/testng-xml-formatter/pull/4)
11+
912
### Added
1013
- Support configurable `NamingStrategy.ExampleName`
1114

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ Feature: Rules
8686
```
8787

8888
Likewise for example tables, the rule (if any), scenario outline name, example
89-
name, and number are included.
89+
name, and number are included. Additionally, if the scenario outline name is
90+
parameterized, the pickle name is included too.
9091

9192
```feature
9293
Feature: Examples Tables
@@ -105,22 +106,45 @@ Feature: Examples Tables
105106
| start | eat | left |
106107
| 12 | 20 | 0 |
107108
| 0 | 1 | 0 |
109+
110+
Scenario Outline: Eating <color> cucumbers
111+
Given I am transparent
112+
When I eat <color> cucumbers
113+
Then I become <color>
114+
115+
Examples:
116+
| color |
117+
| red |
118+
| green |
119+
| blue |
108120
```
109121

110122
```xml
111123
<class name="Examples Tables">
112-
<test-method name="Eating cucumbers - These are passing - Example #1.1" status="PASS" duration-ms="7"
124+
<test-method name="Eating cucumbers - These are passing - #1.1" status="PASS" duration-ms="7"
113125
started-at="1970-01-01T00:00:00.001Z" finished-at="1970-01-01T00:00:00.008Z"/>
114-
<test-method name="Eating cucumbers - These are passing - Example #1.2" status="PASS" duration-ms="7"
126+
<test-method name="Eating cucumbers - These are passing - #1.2" status="PASS" duration-ms="7"
115127
started-at="1970-01-01T00:00:00.009Z" finished-at="1970-01-01T00:00:00.016Z"/>
116-
<test-method name="Eating cucumbers - These are failing - Example #2.1" status="FAIL" duration-ms="7"
128+
<test-method name="Eating cucumbers - These are failing - #2.1" status="FAIL" duration-ms="7"
117129
started-at="1970-01-01T00:00:00.017Z" finished-at="1970-01-01T00:00:00.024Z">
118130
<exception class="AssertionError">...</exception>
119131
</test-method>
120-
<test-method name="Eating cucumbers - These are failing - Example #2.2" status="FAIL" duration-ms="7"
132+
<test-method name="Eating cucumbers - These are failing - #2.2" status="FAIL" duration-ms="7"
121133
started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.032Z">
122134
<exception class="AssertionError">...</exception>
123135
</test-method>
136+
<test-method name="Eating &lt;color&gt; cucumbers - #1.1: Eating red cucumbers" status="FAIL" duration-ms="7"
137+
started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.040Z">
138+
<exception class="AssertionError">...</exception>
139+
</test-method>
140+
<test-method name="Eating &lt;color&gt; cucumbers - #1.2: Eating green cucumbers" status="FAIL" duration-ms="7"
141+
started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.048Z">
142+
<exception class="AssertionError">...</exception>
143+
</test-method>
144+
<test-method name="Eating &lt;color&gt; cucumbers - #1.2: Eating blue cucumbers" status="FAIL" duration-ms="7"
145+
started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.056Z">
146+
<exception class="AssertionError">...</exception>
147+
</test-method>
124148
</class>
125149
```
126150
## Contributing

java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<dependency>
5757
<groupId>io.cucumber</groupId>
5858
<artifactId>query</artifactId>
59-
<version>[12.1.1,13.0.0)</version>
59+
<version>[12.2.0,13.0.0)</version>
6060
</dependency>
6161

6262
<dependency>

java/src/main/java/io/cucumber/testngxmlformatter/MessagesToTestngXmlWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class MessagesToTestngXmlWriter implements AutoCloseable {
2828

2929

3030
public MessagesToTestngXmlWriter(OutputStream out) {
31-
this(NamingStrategy.ExampleName.NUMBER, out);
31+
this(NamingStrategy.ExampleName.NUMBER_AND_PICKLE_IF_PARAMETERIZED, out);
3232
}
3333

3434
public MessagesToTestngXmlWriter(NamingStrategy.ExampleName exampleNameStrategy, OutputStream out) {

testdata/attachments.feature.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<test-method name="Byte arrays are base64-encoded regardless of media type" status="PASS" duration-ms="5" started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.030Z"/>
1111
<test-method name="Attaching JPEG images" status="PASS" duration-ms="5" started-at="1970-01-01T00:00:00.031Z" finished-at="1970-01-01T00:00:00.036Z"/>
1212
<test-method name="Attaching PNG images" status="PASS" duration-ms="5" started-at="1970-01-01T00:00:00.037Z" finished-at="1970-01-01T00:00:00.042Z"/>
13-
<test-method name="Attaching images in an examples table - Example #1.1" status="PASS" duration-ms="5" started-at="1970-01-01T00:00:00.043Z" finished-at="1970-01-01T00:00:00.048Z"/>
14-
<test-method name="Attaching images in an examples table - Example #1.2" status="PASS" duration-ms="5" started-at="1970-01-01T00:00:00.049Z" finished-at="1970-01-01T00:00:00.054Z"/>
13+
<test-method name="Attaching images in an examples table - #1.1" status="PASS" duration-ms="5" started-at="1970-01-01T00:00:00.043Z" finished-at="1970-01-01T00:00:00.048Z"/>
14+
<test-method name="Attaching images in an examples table - #1.2" status="PASS" duration-ms="5" started-at="1970-01-01T00:00:00.049Z" finished-at="1970-01-01T00:00:00.054Z"/>
1515
<test-method name="Attaching PDFs with a different filename" status="PASS" duration-ms="5" started-at="1970-01-01T00:00:00.055Z" finished-at="1970-01-01T00:00:00.060Z"/>
1616
</class>
1717
</test>

0 commit comments

Comments
 (0)