Skip to content

Mutually exclusive test cases/groups #463

Description

@zlondrej

My aim is to parallelize tests as much as possible, but I'm also bit restricted by shared resources. I would like a functionality that allows me to mark any test case/group with an exclusivity tag. Any test with an exclusivity tag will not run in parallel with another test with same exclusivity tag, but can run in parallel with other tests that have different or no exclusivity tag.

I can achieve a resource lock by using MVar () or similar synchronization mechanism at the start of the test but this will not prevent tests to be scheduled in parallel and sequentialize, while blocking other tests that could be run in parallel in the meantime.

It's a bit similar to sequentialTestGroup, but there are no dependencies (so more like inOrderTestGroup introduced by #448) and no specific execution order. The main difference to aforementioned functions is that this focuses on scheduling tests with shared resources, rather than their order.

Is there a place for such functionality in this framework, or is this something that should be implemented outside? I was considering if it could be built on top of withResource, but I'm not sure because the resource is shared in the entire sub-tree:

IO a is an action which returns the acquired resource. Despite it being an IO action, the resource it returns will be acquired only once and shared across all the tests in the tree.

Plus I have a feeling that it would just block at test scheduler or test execution level if the withResource was applied on top of TestCase by folding TestTree.

What would be the best way to address such case?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions