feat(junit): add includeRetries option to emit each retry as separate testcase#39464
Conversation
|
@microsoft-github-policy-service agree |
c636f9c to
b2dd3db
Compare
|
@vazidmansuri005 Thank you for the PR! I see that you chose to turn each retry into a I'd like this feature to be immediately useful with existing integrations. If one would need a custom parser for such a junit report, they might as well use the |
|
@dgozman Great point — I've refactored the implementation to use the Maven Surefire JUnit XML schema with How it works now:
Honest assessment of current tool support:
The immediate value even without dedicated UI:
That said, I understand your concern about immediate usefulness. If you feel this isn't compelling enough without broader UI support, I'm open to suggestions on a better approach. The |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Hi @dgozman, the changes are pushed — extracted |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f366f43 to
2102824
Compare
Adds an `includeRetries` option (and `PLAYWRIGHT_JUNIT_INCLUDE_RETRIES` env var) to the JUnit reporter. When enabled: - Flaky tests (eventually pass): `<flakyFailure>` elements with `<stackTrace>`, no `<failure>` — test counts as passed - Permanent failures (all retries fail): `<failure>` for the first attempt + `<rerunFailure>` elements for subsequent retries Each retry entry includes `time`, `message`, `type`, `stackTrace`, `system-out`, and `system-err`. Testcase timing uses the successful result for flaky tests and the first result for permanent failures. This follows the Maven Surefire JUnit XML schema and is supported by Jenkins, Allure, and Gradle. Tools that don't recognize these elements safely ignore them. Closes microsoft#29446
2102824 to
0731215
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@vazidmansuri005 Please fix the lint failures. See contributing guide for more details. |
2faa362 to
615eb87
Compare
…Entry Fix TS18048 lint errors where entry.children is possibly undefined. The caller always initializes children as an empty array, so non-null assertion is safe here.
615eb87 to
8e4ac84
Compare
|
@dgozman Fixed — added non-null assertions for |
Test results for "MCP"6 failed 5121 passed, 164 skipped Merge workflow run. |
Test results for "tests 1"1 flaky38837 passed, 841 skipped Merge workflow run. |
Summary
Adds an
includeRetriesoption to the JUnit reporter that emits retry information using the Maven Surefire JUnit XML schema:<flakyFailure>elements with<stackTrace>, no<failure>— test counts as passed<failure>for the first attempt +<rerunFailure>elements for subsequent retries — test counts as failedThis follows the established schema from
maven-surefire-pluginand is natively supported by Jenkins (JUnit plugin, since late 2025), Allure, and Gradle (mergeReruns). Tools that don't recognize these elements (GitHub Actions, GitLab CI, etc.) safely ignore them, so flaky tests still show as passed.Configuration
Or via environment variable:
XML Output Examples
Flaky test (fails twice, passes on retry #2):
Permanent failure (fails all retries):
Edge Cases
<flakyFailure>elements<rerunFailure>elementsincludeRetriesdisabled (default)<flakyError>/<rerunError>insteadTest Plan
<flakyFailure>elements, counts as passed<failure>+<rerunFailure>, counts as failedincludeRetriesis not setCloses #29446