Geeks With Blogs

News View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn
Michael Stephenson keeping your feet on premise while your heads in the cloud

I got some feedback a while ago asking for some advice on how we test flat file schemas and have eventually got around to writing this post.

The aim of testing schemas which have been created to represent a flat file (positional or delimited) is to be able to test the schema in isolation to ensure that it can be used to parse and assemble a message correctly.

The reason testing the schema in isolation is important is that it allows you to ensure it works before the schema is used within BizTalk where problems will take more time to troubleshoot and require deployment to BizTalk to do any testing.

Normally when this is done people will create BizTalk pipelines and test this with BizUnit but we have actually used the Pipeline Component Test Library which actually contains some classes which make this really easy to do.

The Sample

In the below sample you can see I have creates a solution structure containing two projects. One is a BizTalk project containing flat file schemas. One schema represents a positional file and the other represents a delimited file.

In the C# Test project I have creates tests for each schema and there are input files for each schema to support testing of assembly and disassembly with each schema.


There are 4 tests.

The assembly tests will take an xml input file representing the schema and then run the assemble process and produce the appropriate flat file.

The disassembly tests will take a flat file and run the disassembly process to produce an xml file of the parsed input in an xml format.

The below code snippet from the tests shows how we use the SchemaTester which is a generic class which you can type to be relevant to your BizTalk schema type. The SchemaTester then provides methods to do each of the types of testing.


Normally what I would do after SchemaTester has ran and produced the output file is to do some kind of binary comparison against a known expected copy of what the xml should look like.


Hopefully you can see this is quick and easy to implement and can save you a lot of time in getting these schemas right.

The downloadable sample is available from the following location:


Posted on Wednesday, July 8, 2009 3:27 PM BizTalk , BizTalk Testing , blogdoc | Back to top

Comments on this post: Testing BizTalk Flat File Schemas

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Stephenson | Powered by: