Apache Software Foundation / Maven Surefire
Merged upstreamCorrectnessMerged Jun 27, 2026

Fix reportNameSuffix in XML testcase classname

Fixed Apache Maven Surefire XML report generation so reportNameSuffix is preserved in testcase classname values when the reporter falls back to source text.

apache/maven-surefire · #3379

Problem

After upgrading to Surefire 3.5.4, XML reports could keep the configured suffix on the testsuite name but drop it from the testcase classname attribute. That made report output inconsistent for builds that use reportNameSuffix to distinguish platform, profile, or environment-specific test runs.

Approach

Centralized suffix application in WrappedReportEntry and applied it consistently through getSourceQualifiedName, including the fallback path where the qualified source name is missing and the reporter returns sourceText.

Impact and scope

  • Restores stable XML report identity for Maven Surefire users who rely on reportNameSuffix in CI, platform matrices, or profile-specific report directories.
  • Keeps testcase classname output aligned with testsuite naming, reducing downstream parser and reporting-tool mismatches.
  • Protects the fallback source-name path without changing the existing behavior when qualified source names are available.

Validation

  • Added WrappedReportEntry unit coverage for the sourceText fallback with a reportNameSuffix.
  • Added Surefire3210ReportNameSuffixIT with a fixture verifying generated XML contains the suffix in both testsuite name and testcase classname.
  • PR validation covered focused unit tests, the Surefire integration-test fixture, full Maven clean install, run-its, and git diff checks.