Package org.apache.beam.sdk.testing
Class BeamParallelJunit4Runner
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<FrameworkMethod>
org.junit.runners.BlockJUnit4ClassRunner
org.apache.beam.sdk.testing.BeamParallelJunit4Runner
- All Implemented Interfaces:
Describable,Filterable,Orderable,Sortable
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@Testmethods annotated with@Category(ValidatesRunner.class)(defaults tobeam.test.parallelThreads).-Dbeam.test.parallelThreads=N: number of concurrent threads per test worker JVM for all other@Testmethods (defaults to1, 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).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceMarks a test class or@Testmethod as requiring serial (non-parallel) execution even when parallel test execution is enabled. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectHands the test instance to itsTestPipelinerule(s), which inspect the instance's other rules to decide whether the test's pipeline may be merged with others.protected voidrunChild(FrameworkMethod method, RunNotifier notifier) Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutMethods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
-
Field Details
-
VALIDATES_RUNNER_THREADS_PROPERTY
- See Also:
-
DEFAULT_TEST_THREADS_PROPERTY
- See Also:
-
-
Constructor Details
-
BeamParallelJunit4Runner
- Throws:
InitializationError
-
-
Method Details
-
createTest
Hands the test instance to itsTestPipelinerule(s), which inspect the instance's other rules to decide whether the test's pipeline may be merged with others. ATestRulenever sees the instance itself; the runner is the only place that does.- Overrides:
createTestin classBlockJUnit4ClassRunner- Throws:
Exception
-
runChild
- Overrides:
runChildin classBlockJUnit4ClassRunner
-