Search code examples
javaconcurrencyautomated-testsintegration-testingjunit5

JUnit 5 suites do not run parallel


I have a parent suite, that includes child suites, which themselves include different tests (the same test may be included in multiple child suites). If I enable concurreny, only those tests inside a child suites are running parallel. The child suites themselve are not running parallel. But I want the child suites to run parallel also (or just the child suites).

Parent suite:

@Suite
@IncludeTags({"DifferentTagsUsedInTests"})
@SelectClasses({ChildSuiteA.class, ChildSuiteB.class})
@ConfigurationParameter(key = "config for all tests", value = "within this suite")
public class ParentSuite {}

Child suite:

@Suite
@IncludeTags({"DifferentTagsUsedInTests"})
@SelectPackages("my.tests")
@ConfigurationParameter(key = "additional config for all tests", value = "within this suite")
public class ChildSuiteA {}

Solution

  • The short answer is that the JUnit Platform Suite Engine doesn't support parallel execution.

    Conceptually JUnit 5 consists of the JUnit Platform + Several Test Engines. The property that you've used to enable parallel execution is prefixed with junit.jupiter.. This shows that it only applies to the Jupiter Engine, not the Suite Engine. And there is no equivalent property for the Suite Engine.