Class BeamParallelJunit4Runner

All Implemented Interfaces:
Describable, Filterable, Orderable, Sortable

@Internal public final class BeamParallelJunit4Runner extends BlockJUnit4ClassRunner
A JUnit 4 runner that supports concurrent execution of @Test methods within a test class, with independent parallelism settings for ValidatesRunner tests versus other tests:
  • -Dbeam.validatesRunner.parallelThreads=N: number of concurrent threads per test worker JVM for @Test methods annotated with @Category(ValidatesRunner.class) (defaults to beam.test.parallelThreads).
  • -Dbeam.test.parallelThreads=N: number of concurrent threads per test worker JVM for all other @Test methods (defaults to 1, i.e., sequential execution).

Classes or methods annotated with BeamParallelJunit4Runner.SerialTest are always executed sequentially on the calling thread after draining any in-flight parallel test methods in the class.

Runners that merge the pipelines of concurrently running tests into one job rely on this runner in two ways: it lets each TestPipeline rule see its test instance (to recognize tests that must not be merged), and it re-executes a test once, from scratch and with merging disabled, when the runner could not reach a verdict for it from a merged job (see TestPipeline.StandaloneRerunRequested).