« Two Things About VPC | Main | Validation In Monorail »
I'm please to announce the release of Version 1.1 of my PipelineTesting library for BizTalk Server 2006. PipelineTesting can be used with your favorite unit testing framework to create automated, repeatable tests for the following BizTalk artifacts:
Version 1.1 adds the following features:
As usual, the library can be downloaded here. The package includes all source code for the library itself and its unit tests, and a pre-compiled binary and XML doc comments file.
Using the library
To use the library, you need to reference the following assemblies:
You will need to include the following namespaces:
using Winterdom.BizTalk.PipelineTesting; using Winterdom.BizTalk.PipelineTesting.Simple;
I won't cover all the API, however, let me introduce the basic mechanics of how the library can be used.
The general way in which the library is used is:
Example: A simple XML Send Pipeline
The following example shows how to create a standard XMLTransmit pipeline, provide a schema to use and execute the pipeline with an input message:
string msgBody = "..."; SendPipelineWrapper pipeline = Pipelines.Xml.Send() .WithSpec<Schema1_NPP>(); IBaseMessage output = pipeline.Execute( MessageHelper.CreateFromString(msgBody) );
Here's a more interesting test for a send pipeline. This one will create an empty Send pipeline, add a standard XML Assembler component to it, configured with an Envelope and a Document schema and then feed multiple input messages to be assembled into a single one, encoded with S/MIME:
XmlAssembler xml = Assembler.Xml() .WithDocumentSpec<SimpleBody>() .WithEnvelopeSpec<SimpleEnv>(); SendPipelineWrapper pipeline = Pipelines.Send() .WithAssembler(xml) .WithEncoder(new MIME_SMIME_Encoder()); // Create the input message to pass through the pipeline string body = "<o:Body xmlns:o='http://SampleSchemas.SimpleBody'>" + "this is a body</o:Body>"; // Execute the pipeline, and check the output // we get a single message batched with all the // messages grouped into the envelope's body IBaseMessage outputMessage = pipeline.Execute( MessageHelper.CreateFromString(body), MessageHelper.CreateFromString(body), MessageHelper.CreateFromString(body) ); Assert.IsNotNull(outputMessage);
Notice that, in this example, we didn't explicitly add the schemas to the pipeline itself; that's because when they are configured on the XML assembler, the pipeline picks it up automatically.
In this example, I'll create a new receive pipeline and add a Flat File disassembler to it to parse a flat file from a BizTalk schema:
FFDisassembler ff = Disassembler.FlatFile() .WithDocumentSpec<Schema3_FF>(); ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithDisassembler(ff); IBaseMessage input = MessageHelper.CreateFromStream( DocLoader.LoadStream("CSV_FF_RecvInput.txt") ); MessageCollection output = pipeline.Execute(input); Assert.AreEqual(1, output.Count);
This brief introduction should give you an idea of the capabilities of the PipelineTesting library. As you can see, the new API is fairly intuitive and simple to use and everyone should be able to use it with minimal effort.
If you have any questions, comments or run into a bug, do let me know; I'll do my best to answer and fix any issues!
About
Tomas Restrepo is co-founder of devdeo. His interests include .NET, Connected Systems, PowerShell and, lately, dynamic programming languages. More...
email: tomas@winterdom.com msn: tomasr@passport.com twitter: tomas_restrepo
Technorati Profile
Syndicate
Ads
Links
Categories
Statistics
Blogroll
Post Archive
Other
Copyright © 2002-2008, Tomas Restrepo.
Powered by: newtelligence dasBlog 1.9.7174.0