Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally run tests within @Isolated class concurrently #4346

Open
3 tasks
kriegaex opened this issue Feb 26, 2025 · 0 comments
Open
3 tasks

Optionally run tests within @Isolated class concurrently #4346

kriegaex opened this issue Feb 26, 2025 · 0 comments

Comments

@kriegaex
Copy link

kriegaex commented Feb 26, 2025

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant