Skip to content

Avoid quadratic XML report writes for ParameterizedClass - #3471

Open
xujiantop-crypto wants to merge 1 commit into
apache:masterfrom
xujiantop-crypto:fix/parameterized-class-xml-reporting
Open

xujiantop-crypto wants to merge 1 commit into
apache:masterfrom
xujiantop-crypto:fix/parameterized-class-xml-reporting

Conversation

@xujiantop-crypto

Copy link
Copy Markdown

Following the Maven Surefire contribution checklist:

  • The commit has a meaningful subject and body.
  • The pull request description explains the behavior, cause, and fix.
  • Module verification and focused tests were run locally.
  • The full integration-test profile was not run locally.

Fixes #3439.

JUnit 5.14 ParameterizedClass emits one ClassSource across multiple class-template-invocation containers. RunListenerAdapter previously opened and closed the same test set for every invocation. StatelessXmlReporter then rewrote the accumulated report after each invocation, making the write cost quadratic in the number of invocations.

This keeps the report lifecycle open for a parameterized class branch and flushes the collected source reports once the class template completes. Ordinary nested class containers retain their independent lifecycles.

Validation:

  • mvn -Denforcer.skip=true -DskipTests -pl surefire-providers/surefire-junit-platform -am verify
  • RunListenerAdapterTest: 40 tests passed via the JUnit Platform launcher
  • StatelessXmlReporterTest: 14 tests passed via the JUnit Platform launcher
  • JUnit 5.14.4 sample with three @ParameterizedClass values: one XML report with tests="3" and all three invocation testcases

Keep parameterized class invocations in one report lifecycle and flush the accumulated test set once the class template completes. Preserve independent lifecycles for ordinary nested classes.
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.

StatelessXmlReporter + ParameterizedClass leads to quadratic writes

1 participant