Skip to content

Restore reportNameSuffix in testcase classname attribute (regression since 3.5.4)#3265

Open
UtkarshSinghChauhan wants to merge 1 commit intoapache:masterfrom
UtkarshSinghChauhan:fix-testcase-classname-suffix
Open

Restore reportNameSuffix in testcase classname attribute (regression since 3.5.4)#3265
UtkarshSinghChauhan wants to merge 1 commit intoapache:masterfrom
UtkarshSinghChauhan:fix-testcase-classname-suffix

Conversation

@UtkarshSinghChauhan
Copy link

This pull request addresses a regression introduced in version 3.5.4 where the configured reportNameSuffix is no longer appended to the classname attribute in the generated XML report.
In version 3.5.3, the StatelessXmlReporter used report.getSourceName(reportNameSuffix) when generating the element. This ensured that any configured suffix (for example, (Linux)) was correctly included in the classname attribute of the XML output.
However, in 3.5.4 the logic was modified to prefer report.getSourceText(). While this change may have been intended to improve source handling, it unintentionally bypasses the reportNameSuffix logic. As a result, the suffix is omitted from the XML report even when it is explicitly configured.
For example:
Expected behavior (3.5.3):
<testcase classname="com.example.MoneyTest(Linux)" ... />

Actual behavior (3.5.4):
<testcase classname="com.example.MoneyTest" ... />

This patch restores the previous behavior by ensuring that report.getSourceName(reportNameSuffix) is used so that the configured suffix is consistently preserved in the XML output.
The change was verified by:
Building the project with mvn clean install
Running tests successfully
Creating a sample project to confirm that the generated XML report includes the expected suffix

This restores backward compatibility and aligns the behavior with user expectations when reportNameSuffix is configured.

@slawekjaranowski slawekjaranowski linked an issue Feb 17, 2026 that may be closed by this pull request
String className = phrasedClassName
? report.getReportSourceName(reportNameSuffix)
: report.getSourceText() != null ? report.getSourceText() : report.getSourceName(reportNameSuffix);
: report.getSourceName(reportNameSuffix);
Copy link
Member

Choose a reason for hiding this comment

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

@slawekjaranowski
Copy link
Member

do we have any test for it? 🤔

@olamy
Copy link
Member

olamy commented Feb 17, 2026

do we have any test for it? 🤔

I agree
@UtkarshSinghChauhan please provide some IT test for such change

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

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

This needs a test to prevent regressions from happening again.

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.

Missing suffix in testcase classname XML report

4 participants