Skip to content

When only the RepeatedTest method is included in the unit test, BeforeAll is executed after all the methods have been executed in a different order than expected #4071

@GaulleGL

Description

@GaulleGL

JUnit5 version:5.11.1
code:

class HelloWorldTest {

    @BeforeAll
    public static void beforeAll() {
        System.out.println("BeforeAll...");
    }

    @RepeatedTest(2)
    void test() {
        System.out.println("test execute");
    }

    @RepeatedTest(2)
    void test1() {
        System.out.println("test1 execute");
    }

    @AfterAll
    public static void afterAll() {
        System.out.println("AfterAll...");    }
}

Console output:
test execute
test execute
test1 execute
test1 execute
BeforeAll...
AfterAll...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions