PipelineTesting 1.2.1.0 Released
Last week I spent some time working on a new minor release of my PipelineTesting library for BizTalk Server 2006/R2. The new release is available in the usual places: Binary and Source Snapshot, and the Source Repository at GitHub.
The new release includes some minor documentation updates, a couple of bug fixes and a new wrapper for doing basic testing of flat file and xml schemas that provides a somewhat equivalent functionality to that offered by the TestableSchema class offered in BizTalk 2009 I’ve talked about before.
Here’s the documentation and sample for the new functionality.
Testing Schemas
It is possible to target BizTalk schemas in your testing efforts using all versions of PipelineTesting if you don’t mind doing a little bit of grunt work. This is possible for both flat file and xml schemas, and is done simply by instantiating a pipeline (either a compiled pipeline or by creating a new one from scratch) and then running your instance documents through it and checking the output.
This works particularly well for advanced scenarios involving envelopes or batching/debatching, but it’s overkill for the simple scenarios.
Beginning with PipelineTesting v1.2.1.0, there’s a new feature for easy testing of schemas in those simple scenarios. Partially inspired by the new functionality offered in BizTalk Server 2009, the SchemaTester<T> class allows you to parse/assemble a document according to a single document schema with a single method call.
To use SchemaTester<T>, simply provide the type of the BizTalk schema to use and call one of it’s static methods. The options offered are:
- ParseFF: Parses a flat file into an XML document
- ParseXml: Parses an XML document
- AssembleFF: Assembles an XML document into a new flat file
- AssembleXml: Assembles an XML document
All method come with overloads that use streams or paths to files. Here’s an example of how to use it based on one of the unit tests for this feature:
Stream input = DocLoader.LoadStream("CSV_FF_RecvInput.txt");
Stream output = SchemaTester<Schema3_FF>.ParseFF(input);
// Load resulting XML document
XmlDocument doc = new XmlDocument();
doc.Load(output); If the document cannot be converted, an exception will be raised. Remember that you must consume the resulting stream (if using the stream-variants of the SchemaTester<T> methods). You can then check the resulting exception to look into why the parsing/assembling is failure.
To make it easier to deal with the different parsing exceptions, and how to extract meaningful information out of it, you can use the ErrorHelper.GetErrorMessage() helper method.






Tomas, this is a fantastic tool.
). I have a question though: my team has been trying to automate processing of edi files(x12). specifically 837 translation. can you offer any help in that area? Thanks.
You saved my team a ton of time (you should charge for downloads
@Roman: Thanks for the kind words, they are always appreciated
What exactly are you looking for in EDI processing? I’m afraid there are some limits in what I can do there, mostly because the EDI components that BizTalk provides have some nasty dependencies that usually stop them from running outside of the messaging engine (I seem to recall they won’t even run in pipelines executed inside an orchestration).
I’m trying to use your PipelineTesting 1.2 but I can’t seem to instantiate or call the DocLoader class (I do have a reference to the Winterdom.BizTalk.PipelineTesting assembly). Why can I not seem to call this class?
@Adrian: The DocLoader class used in the Unit Tests isn’t part of the library per-se, it’s just a helper class in the unit tests project to extract the sample input messages out of resources compiled into the test assembly.
You can certainly grab the code for that and use it from Winterdom.BizTalk.PipelinelineTesting.Tests\DocLoader.cs.
Thanks Tomas…
One question, how can I get my test xml message into the stream object without using your DocLoader class?
@Adrian: Where is you test XML message? If it’s a file, just use FileStream. If it’s content you have in a string or something, just write it to a MemoryStream. Or just use MessageHelper.CreateFromString() instead.
thanks for the tips…I have it working. Great tool by the way, I’m loving it!