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

feat(j unit reporter): adds reporting on retries to JUnit reporter #35323

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

carolopolo
Copy link

@carolopolo carolopolo commented Mar 21, 2025

Fixes #29446

Currently, test retries aren't captured in Playwright's JUnit reporter output, and consumers don't have the ability to easily perform flaky test analysis. Also, test case records currently don't have a path attribute, which is important for some tools parsing failure outputs for analytics.

This PR adds reporting on every retry and outputs a <failure> per attempt, and modifies the message and type attributes. Since we're now iterating through the test.results, this PR attaches test.annotations to the last test run. Since "it is important to only produce a single system-out entry", that is now attached to the last test run.

This is just a starting point of what this feature could look like, and I'd love to your feedback!

@carolopolo
Copy link
Author

@microsoft-github-policy-service agree company="Shopify"

@@ -102,6 +102,17 @@ class JUnitReporter implements ReporterV2 {
}
}

private _extractErrorAttributes(error: TestError) {
let message = '';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could provide a default error message

@carolopolo carolopolo changed the title [Feature] Add reporting on retries to JUnit reporter feat: adds reporting on retries to JUnit reporter Mar 21, 2025
Copy link
Contributor

Test results for "tests 1"

5 flaky ⚠️ [firefox-library] › tests/library/inspector/cli-codegen-pick-locator.spec.ts:35:7 › should update locator highlight @firefox-ubuntu-22.04-node18
⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/browsercontext-viewport-mobile.spec.ts:87:5 › mobile viewport › should support window.orientation emulation @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/screenshot.spec.ts:66:14 › page screenshot › should work with a mobile viewport and fullPage @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

38812 passed, 809 skipped
✔️✔️✔️

Merge workflow run.

@carolopolo
Copy link
Author

@dgozman @pavelfeldman 📿

@carolopolo carolopolo changed the title feat: adds reporting on retries to JUnit reporter feat(j unit reporter): adds reporting on retries to JUnit reporter Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Add all retries as test runs to JUnit report
1 participant