Skip to content

Latest commit

 

History

History
71 lines (49 loc) · 2.4 KB

TestingPipelines.md

File metadata and controls

71 lines (49 loc) · 2.4 KB

Testing Pipelines and Generating Output

Contents

When verifying a pipeline graph, you can generate either a GraphViz diagram or an image in PNG or SVG format. This is done using ApprovalTests.

GraphViz

If you want to verify a Pipeline, you can call PipelineApprovals.Verify():

var input = new InputPipe<long>("value");
input.ProcessFunction(LongToString);
input.ProcessFunction(IncrementLong);

PipelineApprovals.Verify(input);

snippet source | anchor

Which produces the following approved file:

digraph G { node [style=filled, shape=rect]

# Nodes
"Int64 value" -> "PipelineTests.LongToString()" -> "String"
"Int64 value" -> "PipelineTests.IncrementLong()" -> "Int64"


# Formatting
"Int64 value" [color=green]
"String" [color="#9fbff4"]
"PipelineTests.LongToString()" [shape=invhouse]
"Int64" [color="#9fbff4"]
"PipelineTests.IncrementLong()" [shape=invhouse]



}

anchor

Usually we open these in Visual Studio Code with a plugin. The advantage of these files is that they diff easily and render nicely.

PNG/SVG

If you want to create the images, you can do that automatically as well, using the following:

var input = CreateQuickPipelineWithInput();
PipelineApprovals.VerifyAsPng(input);

snippet source | anchor

which produces the following approved file:

GraphViz of Pipeline in PNG format