public class TestPipeline extends Pipeline
It is recommended to tag hand-selected tests for this purpose using the RunnableOnService Category annotation, as each test run against the service will spin up and tear down a single VM.
In order to run tests on the dataflow pipeline service, the following conditions must be met:
Use DataflowAssert for tests, as it integrates with this test
harness in both direct and remote execution modes. For example:
Pipeline p = TestPipeline.create();
PCollection<Integer> output = ...
DataflowAssert.that(output)
.containsInAnyOrder(1, 2, 3, 4);
p.run();
Pipeline.PipelineExecutionException, Pipeline.PipelineVisitor| Modifier and Type | Method and Description |
|---|---|
static TestPipeline |
create()
Creates and returns a new test pipeline.
|
PipelineResult |
run()
Runs this
TestPipeline, unwrapping any AssertionError
that is raised during testing. |
String |
toString() |
addValueInternal, apply, apply, applyTransform, applyTransform, begin, create, getCoderRegistry, getFullNameForTesting, getOptions, getRunner, setCoderRegistry, traverseTopologicallypublic static TestPipeline create()
Use DataflowAssert to add tests, then call
Pipeline.run() to execute the pipeline and check the tests.
public PipelineResult run()
TestPipeline, unwrapping any AssertionError
that is raised during testing.