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

After doing some stuff recently with the Pipeline Component Test Library by Tomas Restrepo I had a bit of an idea on a different way this library can help you during the development process.  On the back of this idea I have created a small tool on codeplex which will help you create sample flat file messages.  The rest of this article will describe how this tool can help.

Get the tool here: http://www.codeplex.com/BizTalkSampleMessage

Get Pipeline Test Library Here: http://www.winterdom.com/weblog/2006/04/27/PipelineTestingLibraryPart1.aspx

The Challenge

When you are doing a BizTalk implementation that involves communicating with systems via the exchange of a flat file message between BizTalk and the external system you usually end up with the lovely task of having to create sample messages to help you test your implementation.  In these situations you could expect to see some of the following scenarios/practices:

  • You might receive a set of "test messages" from the owners of the external system which cover only some of the possible test cases
  • You spend ages creating test messages
  • Your test messages are a nightmare to maintain and any changes to the message specification are error prone

The key point is that keeping an effective testing strategy around this becomes a lot of effort which is not a good thing when you want to maintain a high standard of quality.

The Sample Message Creator

The sample message creator is a tool which I have created to try and reduce the pain of creating sample flat file messages for your testing effort.  The process of using the tool is as follows:

Assumptions

Before I describe how to use the sample message generator I assume that you have done the following:

  1. You have created a schema in a BizTalk project representing your flat file structure
  2. You have added the assembly containing your schema to the GAC (possibly by deploying it to BizTalk)

Creating an instance of your schema

The first step to creating your sample message is to right click on the schema in Visual Studio and use the Generate Instance context menu option to generate an example instance of the schema.  This will give you an xml example. 

You should then save this xml as you will use it as the input to the tool.

Amending the Xml

The idea is that you will manually amend this xml to contain the data items you want to be in the output file.  Because this is in xml it should be much easier to edit this data and get it correct than it would be to edit the flat file directly where 1 wrong character could totally break your file and make it difficult to spot the problem.

Using the tool

When you have downloaded and opened the sample message creator, go to the tools menu and the Flat File --> Assemble options to open the Form which will help you create your sample.

Providing the options to generate your sample

The form will ask you for the following information in order to be able to create your sample:

  • Input File - This is the file that contains the xml we created above
  • Output File - This is the location where the output will be created
  • Schema Assembly - This is the path to the assembly containing your schema
  • Schema Type - When you have selected the assembly path, this drop down will be populated with a list of the schema types within the assembly.  You should select the one you need

You are now ready to click the generate button which will produce your output file which you can now use in your tests

Background on the tool

Internally when generating the sample file, the tool will begin by validating the input file against the schema to ensure it is valid.  Then the tool uses the Pipeline Component Test Library to execute the Flat File Assembler component to assemble the flat file message from the xml represented by the schema and hey presto there is your sample message.

Summary

This tool is pretty simple, but I have done a bit of work in the past with some nasty positional files where this would have been very helpful.

Also a final note just to thank Tomas for agreeing to allow me to utilise his library when publishing this tool.

Source: http://geekswithblogs.net/michaelstephenson/Default.aspx

Posted on Sunday, April 13, 2008 12:14 AM BizTalk | Back to top


Comments on this post: BizTalk Flat File Sample Messages for Testing

# re: BizTalk Flat File Sample Messages for Testing
Requesting Gravatar...
Tried the link but the Codeplex page only has ... "This project is not yet published"
Left by SteveC on Oct 21, 2008 5:31 PM

# re: BizTalk Flat File Sample Messages for Testing
Requesting Gravatar...
Thanks for valualble article, but I think codeplex link is not working. Can you check it.
Left by Vishwanath on Oct 14, 2013 8:40 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Stephenson | Powered by: GeeksWithBlogs.net