Continuing the series of articles on testing in BizTalk, this time I am going to talk about our approach to testing pipelines.
The traditional way to testing pipelines was to use the pipeline.exe tool in the BizTalk SDK. This allows you to use various ways to call this command line tool to execute your pipeline. The key points of this tool are as follows:
- It is a command line tool so is a bit fiddly to call from a C# test but can be done by using the Process object
- It takes input and output documents so you can validate what comes out of the pipeline
- It is awkward to interact with the message context from your test
Pipeline.exe allows you to test, but is best suited to standalone or manual tests and is not easily integrated in a test driven or agile approach.
Preferred Approach
Again as usual the aims of the approach are as follows:
- The tests should be simple to develop and maintain
- They should be automated and fit into a continuous integration process
- We want to test the component before using it in BizTalk
In my preferred approach I like to use the Pipeline Component Test Library to help me execute the pipelines. This is a very similar approach to how I test pipeline components and it also uses the same library. The key difference is that when testing pipeline components I create an empty pipeline in code to execute my component in, where as when testing pipelines I tell the Pipeline Component Library to create a PipelineWrapper object based on my pipeline artifact.
The following picture shows the code sample from my test:

The key points of the sample are:
- My tests project makes a reference to the project containing my pipelines so I can use the .net types which are compiled from my .btp files
- I have full access to the IBaseMessage objects to interrogate the output from the pipeline
- I can use the helper features of the Pipeline Component Test Library to help create my IBaseMessage input instance
- The code required to execute the pipeline is very simple
The sample showing this technique is available below
Source: https://www.geekswithblogs.net/michaelstephenson