allure-framework / allure-java

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

🐞: [JUnit5] Suite view displays both the suite and the package of the test, duplicating the test #1028

Open harmin-parra opened 5 months ago

harmin-parra commented 5 months ago

What happened?

I don't understand why #1004 was rejected.

in my test I have :

public class LabelsTest {

    @Test
    public void method_name() {
        Allure.epic("Epic");
        Allure.story("Story");
        Allure.suite("Suite");
        Allure.feature("Feature");
    }

}

Test Allure displays both the suite and the package in the Suite view

image

If I set the Allure Suite metadata, why is the report also including the package and showing a duplicate of the test ?

What Allure Integration are you using?

allure-junit5

What version of Allure Integration you are using?

2.26.0

What version of Allure Report you are using?

2.27.0

Code of Conduct

baev commented 5 months ago

Allure JUnit5 sets the "suite" label for each test automatically. If you want to override it, you need to remove it from the result first:

Allure.getLifecycle().updateTestCase(tr -> tr.getLabels().removeIf(label -> "suite".eq(label.getName())));
Allure.suite("Suite");