Which configuration controls the number of threads JUnit 5 uses for parallel test execution?
0 reputation · 14 Nov 2020, 11:35 UTC
The goal is to understand how JUnit 5 determines the degree of parallelism when the junit.jupiter.execution.parallel.mode property is set to concurrent, especially when latency appears only under concurrent test execution. The framework defaults to using the number of available processors, but there is no standardized mechanism to override this value for an individual test suite or class without altering the global junit-platform.properties file. This lack of per‑suite configurability can lead to inconsistent parallelism levels across different build environments, making it difficult to isolate whether observed latency stems from test‑specific contention or from the underlying thread‑pool sizing.
Is there a way to specify parallelism per test class or method without modifying global properties? How does JUnit decide the pool size when no fixed parallelism is explicitly configured? What effect does the shared ForkJoinPool common pool have on latency when many test methods run concurrently?