https://github.com/cucumber/junit-xml-formatter
JUnit XML formatter for reporting Cucumber results
https://github.com/cucumber/junit-xml-formatter
java polyglot-release tidelift
Last synced: 3 months ago
JSON representation
JUnit XML formatter for reporting Cucumber results
- Host: GitHub
- URL: https://github.com/cucumber/junit-xml-formatter
- Owner: cucumber
- License: mit
- Created: 2022-12-03T15:22:18.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-26T13:20:37.000Z (11 months ago)
- Last Synced: 2024-06-10T10:31:00.403Z (11 months ago)
- Topics: java, polyglot-release, tidelift
- Language: Java
- Homepage:
- Size: 160 KB
- Stars: 2
- Watchers: 9
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://search.maven.org/search?q=g:io.cucumber%20AND%20a:junit-xml-formatter)
⚠️ This is an internal package; you don't need to install it in order to use the JUnit XML Formatter.
JUnit XML Formatter
===================Writes Cucumber message into a JUnit XML report.
The JUnit XML report is
[a de facto standard without an official specification](https://github.com/testmoapp/junitxml/tree/main).
But we validate it against the [Jenkins JUnit XML XSD](./jenkins-junit.xsd) so
there should be a good chance your CI will understand it.If not, please let us know in the issues!
## Features and Limitations
### Test outcome mapping
Cucumber and the JUnit XML Report support a different set of test outcomes.
These are mapped according to the table below.Additionally, it is advisable to run Cucumber in strict mode. When used in
non-strict mode scenarios with a pending or undefined outcome will not fail
the test run ([#714](https://github.com/cucumber/common/issues/714)). This
can lead to a xml report that contains `failure` outcomes while the build
passes.| Cucumber Outcome | XML Outcome | Passes in strict mode | Passes in non-strict mode |
|------------------|-------------|-----------------------|---------------------------|
| UNKNOWN | n/a | n/a | n/a |
| PASSED | passed | yes | yes |
| SKIPPED | skipped | yes | yes |
| PENDING | failure | no | yes |
| UNDEFINED | failure | no | yes |
| AMBIGUOUS | failure | no | no |
| FAILED | failure | no | no |### Step reporting
The JUnit XML report assumes that a test is a method on a class. Yet a scenario
consists of multiple steps. To provide info about which step failed, the `system-out`
element will contain a rendition of steps and their result.```xml
```
### Naming Rules and Examples
Cucumber does not require that scenario names are unique. To disambiguate
between similarly named scenarios and examples the report prefixes the rule
to the scenario or example name.```feature
Feature: RulesRule: a sale cannot happen if change cannot be returned
Example: no change
...
Example: exact change
...Rule: a sale cannot happen if we're out of stock
Example: no chocolates left
...
``````xml
```
Likewise for example tables, the rule (if any), scenario outline name, example
name, and number are included. Additionally, if the scenario outline name is
parameterized, the pickle name is included too.```feature
Feature: Examples TablesScenario Outline: Eating cucumbers
Given there are cucumbers
When I eat cucumbers
Then I should have cucumbersExamples: These are passing
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |Examples: These are failing
| start | eat | left |
| 12 | 20 | 0 |
| 0 | 1 | 0 |Scenario Outline: Eating cucumbers
Given I am transparent
When I eat cucumbers
Then I becomeExamples:
| color |
| red |
| green |
| blue |
``````xml
```
## Android
The Android SDK does not include `javax.xml.stream.XMLOutputFactory`. This and other missing `java.xml.stream.*`
dependencies can be provided by adding `com.fasterxml:aalto-xml` to your dependencies.## Contributing
Each language implementation validates itself against the examples in the
`testdata` folder. See the [testdata/README.md](testdata/README.md) for more
information.