fix(ci): count JUnit errors in Slack failure report#4912
Merged
openshift-merge-bot[bot] merged 1 commit intoJun 3, 2026
Merged
Conversation
The Slack alert was reporting "0 tests failed" even when tests actually failed. The root cause is that the JUnit XML spec distinguishes "failures" (assertion failures) from "errors" (exceptions/timeouts). Playwright reports TimeoutError and similar issues as `errors`, not `failures`. The old code only parsed the `failures` attribute, so any test that failed due to a timeout or exception was silently uncounted. Fix by summing both `failures` and `errors` from the root <testsuites> element. Also add a safety net: if Playwright exits non-zero but the JUnit XML somehow reports 0 failures and 0 errors, report "some" instead of the misleading "0". Verified against build 2061711989599637504 where showcase had failures="0" errors="4" and showcase-runtime had failures="0" errors="8" — both incorrectly reported as "0 tests failed" on Slack. Requested-By: <@U05QPKB8VB3> (gliraesi) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Review Summary by QodoFix Slack CI alert to count JUnit errors in failure report
WalkthroughsDescription• Fix Slack CI alert reporting incorrect test failure counts • Sum both JUnit failures and errors attributes • Handle Playwright crashes/timeouts with safety fallback • Playwright reports timeouts as errors, not failures Diagramflowchart LR
A["Playwright Test Exit Code"] --> B{"Exit Code = 0?"}
B -->|Yes| C["Report 0 failures"]
B -->|No| D["Parse JUnit XML"]
D --> E["Extract failures attribute"]
D --> F["Extract errors attribute"]
E --> G["Sum failures + errors"]
F --> G
G --> H{"Sum = 0?"}
H -->|Yes| I["Report 'some'"]
H -->|No| J["Report actual count"]
I --> K["Slack Notification"]
J --> K
File Changes1. .ci/pipelines/lib/testing.sh
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4912 +/- ##
==========================================
- Coverage 55.82% 55.25% -0.58%
==========================================
Files 121 109 -12
Lines 2350 2132 -218
Branches 562 513 -49
==========================================
- Hits 1312 1178 -134
+ Misses 1032 954 -78
+ Partials 6 0 -6
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Contributor
|
Thanks @gustavolira |
e8d7187
into
redhat-developer:main
25 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
The Slack CI alert was reporting
0 tests failedwith a :circleci-fail: failure emoji, which is contradictory and misleading.Root cause: The JUnit XML spec distinguishes
failures(assertion failures) fromerrors(exceptions/timeouts). Playwright reportsTimeoutErrorand similar issues aserrors, notfailures. The old code intesting.shonly parsed thefailuresattribute:failed_tests=$(grep -oP 'failures="\K[0-9]+' "${e2e_tests_dir}/${JUNIT_RESULTS}" | head -n 1)So any test that failed due to a timeout or exception was silently uncounted, producing
0 tests failedon Slack even though tests actually failed.Evidence from build 2061711989599637504:
showcaseJUnit:failures="0" errors="4"→ Slack showed "0 tests failed" (should be 4)showcase-runtimeJUnit:failures="0" errors="8"→ Slack showed "0 tests failed" (should be 8)Fix: Sum both
failuresanderrorsfrom the root<testsuites>element. Also adds a safety net: if Playwright exits non-zero but JUnit reports 0 of both, report "some" instead of the misleading "0".Test plan
🤖 Generated with Claude Code