allure-framework/allure-java

๐Ÿž: [Junit5] steps and attachments in @BeforeAll method aren't in the Allure report

Opened this issue ยท 0 comments

What happened?

Nor step neither attachment created in @BeforeAll annotated method are in the Allure report

Test code:

`package org.example.junit5;

import io.qameta.allure.Allure;
import io.qameta.allure.Step;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

@testinstance(TestInstance.Lifecycle.PER_CLASS)
public class StepTest {

private static final String GLOBAL_PARAMETER = "global value";
@BeforeAll
@Step("Before all step")
public void setup() {
    Allure.step("Setup step", () -> {
        Allure.addAttachment("Important data", "data");
        Allure.parameter("global", GLOBAL_PARAMETER);
    });
}

@Test
public void annotatedStepTest() {
    annotatedStep("local value");
}

@Test
public void lambdaStepTest() {
    final String localParameter = "parameter value";
    Allure.step(String.format("Parent lambda step with parameter [%s]", localParameter), (step) -> {
        step.parameter("parameter", localParameter);
        Allure.step(String.format("Nested lambda step with global parameter [%s]", GLOBAL_PARAMETER));
    });
}

@Step("Parent annotated step with parameter [{parameter}]")
public void annotatedStep(final String parameter) {
    nestedAnnotatedStep();
}

@Step("Nested annotated step with global parameter [{this.GLOBAL_PARAMETER}]")
public void nestedAnnotatedStep() {

}

}
`

Test report:
image

Expected:
Before all step step in the report

Actual:
only test body steps

Demo project: https://github.com/verusikk/start-java-junit5-gradle-21

What Allure Integration are you using?

allure-junit5

What version of Allure Integration you are using?

2.29

What version of Allure Report you are using?

2.29

Code of Conduct

  • I agree to follow this project's Code of Conduct