Skip to content

Optionally run tests within classes with read-write locks concurrently #4346

@kriegaex

Description

@kriegaex

Previously, there was discussion at #3526, which finally led to creation of this feature request.

Use case and benefit

As a test automation developer, I want to be able to make sure that a specific test class runs in isolation, because otherwise it would upset other tests running concurrently. However, within my test class I want methods to run concurrently to decrease overall execution time, because the tests are slow and the structure of the test allows them to run independently and concurrently.

If e.g. my integration test class has 10 test methods, each taking 30 seconds to run, total runtime is 5 minutes when the tests run serially, but would only be 30-40 seconds when run concurrently. However, if I annotate my class with @Isolated, currently (Platform 1.11.3, Jupiter 5.11.3) this enforces all tests within the class to run serially, i.e. one after another.

Deliverables

I am suggesting one or more of the following:

  • The JUnit platform is enabled to run all or a subset of test methods within a class (or more generally, sub-elements of a certain tree node) concurrently, even if same tree node as such runs in isolation of other nodes.
  • @Isolated gets an optional parameter executionMode defaulting to ExecutionMode.SAME_THREAD, which can be overridden with a value of ExecutionMode.CONCURRENT, resulting in the test class still running in isolation from other classes, but methods within the class running concurrently.
  • Ideally, for more fine-granular control on method level, @Execution annotations can be used to override the default intra-class execution mode specified in @Isolated.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions