allure-framework/allure-java

๐Ÿž: setStatus not updated status and stopStep destroys nesting of steps

VaXoID55 opened this issue ยท 0 comments

What happened?

Example Test:

public class MyTest {
    @Rule
    public Timeout globalTimeout = new Timeout(10, TimeUnit.MINUTES);

    @Test
    @DisplayName("ExampleTestName")
    public void MyTes_1() {
        simpleStep();
    }

    @Step("Inner step")
    private void innerStep(boolean result) {
        Utils.sleep(200);
        StepUtils.setStepStatus(result);
    }

    @Step("Outer step")
    public void simpleStep() {
        step("Simple step");
        step("Simple step with status", Status.FAILED);
        innerStep(true);
        innerStep(false);
        innerStep(true);
        innerStep(false);
    }
}

If use setStepStatus as:

public static boolean setStepStatus(boolean status) {
    if (!status) {
        Allure.getLifecycle().updateStep(result ->
                result.setStatus(Status.FAILED));
        Allure.getLifecycle().stopStep();
    }
    return status;
}

then all nested steps after FAILED cease to be nested, but status step set correctly:
image
If use setStepStatus as (without stopStep()):

public static boolean setStepStatus(boolean status) {
    if (!status) {
        Allure.getLifecycle().updateStep(result ->
                result.setStatus(Status.FAILED));
    }
    return status;
}

the nesting of steps is correct, but the status is not set to FILED
image

What Allure Integration are you using?

allure-junit4

What version of Allure Integration you are using?

2.29.0

What version of Allure Report you are using?

2.29.0

Code of Conduct

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