Skip to content

Tag intermediate initializationError retries with test.final_status=skip in JUnit XML#11010

Open
cbeauchesne wants to merge 9 commits intomasterfrom
cbeauchesne/remove-initialization-error
Open

Tag intermediate initializationError retries with test.final_status=skip in JUnit XML#11010
cbeauchesne wants to merge 9 commits intomasterfrom
cbeauchesne/remove-initialization-error

Conversation

@cbeauchesne
Copy link
Copy Markdown
Contributor

@cbeauchesne cbeauchesne commented Mar 31, 2026

Motivation

When a JUnit setup method (e.g. @BeforeAll) fails and is retried via Gradle's retry plugin, Gradle generates a synthetic <testcase name="initializationError"> for each attempt. If the final retry succeeds, the build passes, but Test Optimization receives all intermediate failure entries with no indication that they were retried, making them appear as genuine failures in the dashboard.

What Does This Do

Add a doLast post-processor to every Test task that rewrites the JUnit XML reports after execution. For any suite with multiple initializationError testcases (i.e. retries occurred), all entries except the last one are tagged with:

<properties>                                                                                                                                                              
    <property name="dd_tags[test.final_status]" value="skip" />                                                                                                             
</properties>                                                                                                                                                             

The last entry is left unmodified, allowing Test Optimization to apply its default status inference based on the actual outcome. Files with only one (or zero) initializationError testcases are not modified.

The post-processor runs as a doLast action directly on the test task, keeping it within the task's up-to-date and caching scope so it doesn't interfere with downstream consumers of the JUnit reports.

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Note: Once your PR is ready to merge, add it to the merge queue by commenting /merge. /merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

@cbeauchesne cbeauchesne added the tag: ai generated Largely based on code generated by an AI or LLM label Mar 31, 2026
@cbeauchesne cbeauchesne changed the title Removes Initialization error from junit XML Tag intermediate initializationError retries with test.final_status=skip in JUnit XML Mar 31, 2026
@cbeauchesne cbeauchesne force-pushed the cbeauchesne/remove-initialization-error branch from eb73143 to fc75f5f Compare April 2, 2026 09:14
@cbeauchesne cbeauchesne marked this pull request as ready for review April 2, 2026 17:28
@cbeauchesne cbeauchesne requested a review from a team as a code owner April 2, 2026 17:28
@cbeauchesne cbeauchesne requested review from erikayasuda and removed request for a team April 2, 2026 17:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@cbeauchesne cbeauchesne added type: enhancement Enhancements and improvements comp: tooling Build & Tooling labels Apr 3, 2026
@bric3 bric3 changed the title Tag intermediate initializationError retries with test.final_status=skip in JUnit XML Tag intermediate initializationError retries with test.final_status=skip in JUnit XML Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM type: enhancement Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants