Skip to content

Add @BeforeAll and @AfterAll hooks  #515

Closed
@aslakhellesoy

Description

@aslakhellesoy

People keep asking for BeforeAll and AfterAll hooks. I haven't had a big need for them myself, but it seems to me this would be sufficient:

public class GlobalHooks {
    private static boolean dunit = false;

    @Before
    public void beforeAll() {
        if(!dunit) {
            Runtime.getRuntime().addShutdownHook(afterAllThread);
            // do the beforeAll stuff...
            dunit = true;
        }
    }
}

If this doesn't cut it for you, please explain in this ticket, and maybe we'll add special support for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🥒 core teamCandidate for going onto the Cucumber Open Board: https://github.com/orgs/cucumber/projects/8🧷 pinnedTells Stalebot not to close this issue

    Type

    No type

    Projects

    Status

    Implemented

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions