Skip to content

Test name duplicated in the report #831

Closed

Description

@iNikem

I have the following simple JUnit test:

  @RepeatedTest(value = 2, name = RepeatedTest.LONG_DISPLAY_NAME)
  @DisplayName("Long name")
  public void repeatLong() {
    Assertions.assertTrue(true);
  }

  @RepeatedTest(value = 2, name = RepeatedTest.SHORT_DISPLAY_NAME)
  @DisplayName("Short name")
  public void repeatShort() {
    Assertions.assertTrue(true);
  }

Here how does the Allure report for it looks like:
Screenshot 2022-10-20 at 10 38 00

As you can see, name of the repeatLong test method has duplicated portion in it. I expect the name to be "Long name :: repetition 1 of 2" instead of "Long name Long name :: repetition 1 of 2".

For reference, this is how test names look in IntelliJ IDEA:
Screenshot 2022-10-20 at 10 40 17

and in gradle html report:
Screenshot 2022-10-20 at 10 40 48

Desktop (please complete the following information):

  • OS: macOS 12.5.1
  • Browser: Safari 15.6.1

JUnit version 5.8.1, Gradle Allure plugin 2.11.0

Activity

  1. baev commented on Oct 20, 2022

    @baev
    Member

    Allure always adds {displayName} for all tests of type test-template-invocation (ParameterizedTest, RepeatedTest etc). That way test names are more readable in Allure for users who uses default configuration.

  2. iNikem commented on Oct 20, 2022

    @iNikem
    Author

    But don't you agree that in this case the end result is bad?

  3. baev commented on Oct 26, 2022

    @baev
    Member

    from UX point of view, default behaviour is much more important. Users who change the defaults are usually have more experience and can tune report to achieve whatever behaviour they want.

    My personal opinion on that is that design of short names in JUnit 5 is a mistake. And now everyone is trying to workaround it in reporting, logging etc. Even IDEA removes prefix of name if it starts with name of parent.

    Allure will support infinite groupings and report correct execution trees someday, but so far it is as it is. Do you have any suggestions how it supposed to be implemented in the first place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions