Skip to content

🐞: [Junit5] steps and attachments in @BeforeAll method aren't in the Allure report #1139

Open
@verusikk

Description

@verusikk

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

Activity

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions