Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
verusikk opened this issue Nov 4, 2024 · 0 comments
Open
1 task done
Labels
triage type:bug Something isn't working

Comments

@verusikk
Copy link

verusikk commented Nov 4, 2024

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
@verusikk verusikk added triage type:bug Something isn't working labels Nov 4, 2024
verusikk pushed a commit to verusikk/start-java-junit5-gradle-21 that referenced this issue Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant