Restore reportNameSuffix in testcase classname attribute (regression since 3.5.4)#3265
Open
UtkarshSinghChauhan wants to merge 1 commit intoapache:masterfrom
Open
Conversation
… from 3.5.3 to 3.5.4)
| String className = phrasedClassName | ||
| ? report.getReportSourceName(reportNameSuffix) | ||
| : report.getSourceText() != null ? report.getSourceText() : report.getSourceName(reportNameSuffix); | ||
| : report.getSourceName(reportNameSuffix); |
Member
There was a problem hiding this comment.
Member
|
do we have any test for it? 🤔 |
Member
I agree |
elharo
requested changes
Feb 22, 2026
Contributor
elharo
left a comment
There was a problem hiding this comment.
This needs a test to prevent regressions from happening again.
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.
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.