Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include pickle name if parameterized #4

Merged
merged 1 commit into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Include pickle name if parameterized [#4](https://github.com/cucumber/testng-xml-formatter/pull/4)

### Added
- Support configurable `NamingStrategy.ExampleName`

Expand Down
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ Feature: Rules
```

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

```feature
Feature: Examples Tables
Expand All @@ -105,22 +106,45 @@ Feature: Examples Tables
| start | eat | left |
| 12 | 20 | 0 |
| 0 | 1 | 0 |

Scenario Outline: Eating <color> cucumbers
Given I am transparent
When I eat <color> cucumbers
Then I become <color>

Examples:
| color |
| red |
| green |
| blue |
```

```xml
<class name="Examples Tables">
<test-method name="Eating cucumbers - These are passing - Example #1.1" status="PASS" duration-ms="7"
<test-method name="Eating cucumbers - These are passing - #1.1" status="PASS" duration-ms="7"
started-at="1970-01-01T00:00:00.001Z" finished-at="1970-01-01T00:00:00.008Z"/>
<test-method name="Eating cucumbers - These are passing - Example #1.2" status="PASS" duration-ms="7"
<test-method name="Eating cucumbers - These are passing - #1.2" status="PASS" duration-ms="7"
started-at="1970-01-01T00:00:00.009Z" finished-at="1970-01-01T00:00:00.016Z"/>
<test-method name="Eating cucumbers - These are failing - Example #2.1" status="FAIL" duration-ms="7"
<test-method name="Eating cucumbers - These are failing - #2.1" status="FAIL" duration-ms="7"
started-at="1970-01-01T00:00:00.017Z" finished-at="1970-01-01T00:00:00.024Z">
<exception class="AssertionError">...</exception>
</test-method>
<test-method name="Eating cucumbers - These are failing - Example #2.2" status="FAIL" duration-ms="7"
<test-method name="Eating cucumbers - These are failing - #2.2" status="FAIL" duration-ms="7"
started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.032Z">
<exception class="AssertionError">...</exception>
</test-method>
<test-method name="Eating &lt;color&gt; cucumbers - #1.1: Eating red cucumbers" status="FAIL" duration-ms="7"
started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.040Z">
<exception class="AssertionError">...</exception>
</test-method>
<test-method name="Eating &lt;color&gt; cucumbers - #1.2: Eating green cucumbers" status="FAIL" duration-ms="7"
started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.048Z">
<exception class="AssertionError">...</exception>
</test-method>
<test-method name="Eating &lt;color&gt; cucumbers - #1.2: Eating blue cucumbers" status="FAIL" duration-ms="7"
started-at="1970-01-01T00:00:00.025Z" finished-at="1970-01-01T00:00:00.056Z">
<exception class="AssertionError">...</exception>
</test-method>
</class>
```
## Contributing
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>query</artifactId>
<version>[12.1.1,13.0.0)</version>
<version>[12.2.0,13.0.0)</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MessagesToTestngXmlWriter implements AutoCloseable {


public MessagesToTestngXmlWriter(OutputStream out) {
this(NamingStrategy.ExampleName.NUMBER, out);
this(NamingStrategy.ExampleName.NUMBER_AND_PICKLE_IF_PARAMETERIZED, out);
}

public MessagesToTestngXmlWriter(NamingStrategy.ExampleName exampleNameStrategy, OutputStream out) {
Expand Down
4 changes: 2 additions & 2 deletions testdata/attachments.feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
</class>
</test>
Expand Down
Loading