Skip to content

[Feature request] Setup and teardown for tests #134171

Closed as duplicate of#117668
Closed as duplicate of#117668
@Adrien-Bodineau

Description

@Adrien-Bodineau

What about introducing new tests attributes for edition 2024 to allow global setup/teardown in tests ?

Something like

#[setup]
fn foo() {
    // do stuff...
}

#[teardown]
fn bar() {
    // undo stuff...
}

setup would run before all tests in its module and teardown after

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-testing-devexRelevant to the testing devex team (testing DX), which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions