I recently wrote an entry describing in general terms the new Unit Testing features in the BizTalk Server 2009 beta. However, I didn’t focus much on the functionality available for testing pipelines and how it related to my own PipelineTesting library.

The BTS09 testing features work by having compiled pipelines derive from the new TestableReceivePipeline and TestableSendPipeline classes, which define a TestPipeline() method for invoking the pipelines with one or more files as input documents and the necessary schemas (as XSD files on disk).

Here’s the canonical sample of how it is used in the documentation:

public void TestMethod() {
   string strSourcePO_XML = @"C:\BizTalkSamples\POProcessing\POInst.xml";

   ReceivePipeline1 rp = new ReceivePipeline1();

   StringCollection documents = new StringCollection();

   StringCollection parts = new StringCollection();

   Dictionary<string, string> schemas = new Dictionary<string, string>();
   schemas.Add("http://POProcessing.PO", @"C:\BizTalkSamples\POProcessing\PO.xsd");

   rp.TestPipeline(documents, parts, schemas);

By comparison, here’s what doing a similar thing with PipelineTesting might look like:

public void TestPipeline() {
   ReceivePipelineWrapper pipeline =
   IBaseMessage input = MessageHelper.CreateFromStream(

   MessageCollection output = pipeline.Execute(input);

Both the BTS09 features as well as PipelineTesting rely on the venerable PipelineObjects.dll assembly originally included in the SDK tools folder (but which now is a more integral part of the product), so general behavior should be relatively similar.

The big difference, however, is flexibility. I designed the original PipelineTesting library to be far more flexible and allow you to do a lot more than simply execute a compiled BizTalk pipeline, which is all the BizTalk 2009 features allow you to do at this time.

This flexibility allows you to also do the following tasks with PipelineTesting:

  • Composing pipelines from arbitrary components at runtime and execute them.
  • Work with compiled BizTalk Schemas instead of the raw XSD files.
  • Doesn’t require you to build a special version of your pipelines to test them.
  • Close control of each part of the pipeline execution process: Control the properties of each component, how schemas are resolved, transaction support, and other things like that.
  • Very good support for multi-part messages.
  • Support for per-instance pipeline configuration

All in all, I’m very happy with PipelineTesting and will favor it when working with BizTalk Server 2009 over it’s own testing features. I also hope to take a couple of ideas to improve PipelineTesting and make it even easier to use and more powerful.

Tomas Restrepo

Software developer located in Colombia.