allure-framework/allure-java

Allure does not create any results when @BeforeClass fails

OlegKuzovkov opened this issue · 4 comments

Describe the bug
We have a test class with @BeforeClass setup. If it fails, no allure-results folder is created with any test results. When you use @before method, all test cases in the class are marked as failed as expected.

To Reproduce
Steps to reproduce the behavior:

import lombok.extern.log4j.Log4j2;
import org.junit.BeforeClass;
import org.junit.Test;


@Log4j2
public class BeforeCassTest {

    @BeforeClass
    public static void before(){
        log.info("failing in before");
        assert false;
    }

    @Test
    public void test1() {
        log.info("passing in test");
        assert true;
    }
}

Expected behavior
allure-results folder should be generated with a test1 marked as failed

Environment
allure-junit4 = 2.17.3
junit = 4.13.2

@OlegKuzovkov
Hi Oleg, could you please attach JUnit4 test results files generated after running of such a test?
thanks

Hi folks, similar case happens with TestNG.
I have several cases where @BeforeClass initializes connections which might fail, and therefore are not reported.

Please, let me know if we should combine implementation/fix or in separate issues.

I'd be happy to help to fix/implement if I can have proper upport.

@vinipx please report this for TestNG separately.
We won't fix this for JUnit4, we recommend moving the project to JUnit5. There will be too much work to fix the behaviour of the framework by means of the integratoin.