-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 classes with read-write locks concurrently #4346
Comments
Thanks for raising the issue! As a workaround, if you're using Gradle, it would be relatively easy to define a second test task for all those classes that shouldn't run in parallel but have their children executed concurrently and configure it with the following configuration parameters:
Instead of annotating them with Having said that, What currently happens if there's a class-level read-write lock is that the execution mode of all of its children is forced to be On the Jupiter side, this could be addressed by extending the existing
The relevant APIs for this on the Platform level are Thoughts? |
The locking system is already complicated, so I'm not sure introducing @Isolated
@Execution(value = CONCURRENT, target = CHILDREN, force = true)
class SomeTests {
@ResourceLock("out")
void testA(){}
@ResourceLock("out")
void testB(){}
void testC(){}
void testD(){}
} You would expect that |
You're right, I had overlooked that use case. 😕 |
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:
@Isolated
gets an optional parameterexecutionMode
defaulting toExecutionMode.SAME_THREAD
, which can be overridden with a value ofExecutionMode.CONCURRENT
, resulting in the test class still running in isolation from other classes, but methods within the class running concurrently.@Execution
annotations can be used to override the default intra-class execution mode specified in@Isolated
.The text was updated successfully, but these errors were encountered: