Skip to content

Is there a way to chain multiples Fixtures? #964

@crakjie

Description

@crakjie

In my project I have different kind of fixture.

Some create client for one database, some create client for http connection.

They are widely used but most of the time independently.

Know I would like to create both clients do some initialization calls and uninitialized after the math.

Here an exemple with cats Ressource to ilustrate.

for { 
     dbClient <- DbRessource()
     httpClient <- HttpRessource()
     localFixture <- LocalRessouce(dbClient, httpClient)
}
yield localFixture

Currently the only way I see this possible with munit is to re-implement the content of DbRessource and HttpRessource into LocalRessouce fixture. Which is doing a lot code duplication when there is a lot of tests with different localFixture.

I did not saw solution for this problem in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions