After enabling parallel test execution, JUnit Jupiter can be asked to use one of three strategies to determine the concurrency of our test suite. These strategies take different approaches to configure the environment of the parallel execution, such as the number of threads to use.
In this lesson, the default strategy, dynamic, is presented. This particular implementation determines concurrent potential based on the number of CPU cores on the host machine, multiplied by a constant "factor" value, which can be configured through a configuration parameter. Let's have a look at how a test class executes eight tests at the same time with this configuration!
- Dynamic is the default parallel execution strategy
- It utilizes the number of CPU cores to determine parallelism
- To set this strategy explicitly, use configuration parameter
- To scale this value, use configuration parameter
junit.jupiter.execution.parallel.config.dynamic.factorand set it to an
intvalue (default: 1)