allure-framework / allure-java

Allure integrations for Java test frameworks
Apache License 2.0
355 stars 224 forks source link

šŸž Duplicate test case names for test-template-invocation tests #1122

Open EPadronU opened 1 month ago

EPadronU commented 1 month ago

What happened?

The current implementation for handling test-template-invocation tests, such as when the @RetryingTest annotation is used, automatically prepends the displayName of the parent test to the generated test case names. This results in duplicated and cluttered test case names within the Allure report, negatively impacting readability and usability.

This issue echoes concerns previously highlighted in Issue #831, where similar naming challenges were discussed.

Example code

@RetryingTest(maxAttempts = 3, name = "{displayName} [Attempt {index}]")
public void shouldWorkAsExpected() {
    Assertions.assertTrue(true);
}

Current Behavior

The Allure report currently generates names like:

This duplication detracts from the reportā€™s clarity and makes navigation cumbersome.

Screenshots

Expected Behavior

The test case names in the Allure report should be concise, with unnecessary repetition removed, such as:

Screenshots

Proposed solution

To enhance the usability of the Allure reports, I propose introducing a configuration flag, such as allure.disableDisplayNamePrepend, that would allow users to opt-out of the automatic prepending of the displayName for test-template-invocation scenarios.

Implementation details

Considerations

Final words

I am confident that this enhancement will significantly improve the Allure report's usability and interoperability.

Thank you for your attention to this matter and for considering the proposed improvement.

What Allure Integration are you using?

allure-junit5

What version of Allure Integration you are using?

2.29.0

What version of Allure Report you are using?

2.30.0

Code of Conduct