Executing suites, classes and methods with defined concurrency. In this example the threads which completed
the suites and classes can be reused in parallel methods.
JUnitCoreParameters parameters = ...;
ParallelComputerBuilder builder = new ParallelComputerBuilder(parameters);
builder.useOnePool(8).parallelSuites(2).parallelClasses(4).parallelMethods();
ParallelComputerBuilder.ParallelComputer computer = builder.buildComputer();
Class>[] tests = {...};
new JUnitCore().run(computer, tests);
Note that the type has always at least one thread even if unspecified. The capacity in
useOnePool(int)
must be greater than the number of concurrent suites and classes
altogether.
The Computer can be stopped in a separate thread. Pending tests will be interrupted if the argument is
true.
computer.describeStopped(true);