Michael Stephenson

keeping your feet on premise while your heads in the cloud
posts - 257, comments - 277, trackbacks - 11

My Links

News

View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn

Twitter












Archives

Post Categories

Image Galleries

BizTalk

Mates

BizTalk Testing Series – Testing Maps in BizTalk 2009

A while back in my series of articles about testing with BizTalk I covered a technique for testing maps. The background to the approach is still valid in BizTalk 2009, but the technique is improved. To review the previous article refer to the following link:

http://geekswithblogs.net/michaelstephenson/archive/2008/03/30/120851.aspx

In this post although we could do testing of maps, to be honest it was a little bit of a pain. In the newly released BizTalk 2009 CTP there have been some improvements in how you can do some of the testing and I would like to demonstrate this. I will walk through the steps to test your schema.

I will extend on the sample from the previous post about testing schemas. So our solution now looks like the below picture containing an additional schema and a new map.

  1. Configure your BizTalk Project for Tests

Just to reiterate this step from the previous post you need to ensure the enable unit testing property is set for the BizTalk project.

 

  1. Adding references to your test assembly

Again reiterating this step, in your test project you will need to add a couple of references, the main one is the new Microsoft.BizTalk.TestTools assembly which is in the Visual Studio Add Reference list. This will allow you to use these new testing features.

 

  1. The test code

In the below picture you can see that I am doing two things. The first is that I create an instance of the new TestableMapBase class which my map derives from. I can use this to execute my map by passing the details of an input file. The results are written to the output file.

I'm also using the schema validation to confirm that the message is valid that comes out. I think there are also properties of the TestableMapBase object which can do this.

In practice when I use this technique I will probably execute the map with a known input file and then compare the results of the output file with a predefined example output file so rather than just validating the schema I'm actually also ensuring the content is exactly as expected. You can do this with a binary comparison of the file.

Summary

As you can see this new technique just simplifies what we had been doing in BizTalk 2006 R2 and is a very nice interface to support this testing.

The sample for this demo is available at the following location: http://www.box.net/shared/yro0poto3m

If you have problems accessing it then let me know.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Friday, December 12, 2008 12:45 AM | Filed Under [ BizTalk Testing ]

Feedback

Gravatar

# re: BizTalk Testing Series – Testing Maps in BizTalk 2009

Hi Mike,

This is great source. How do you test this new codes? Latest MSDN BizTalk 2009 Virtual Lab Exerciste #15 talks about it, but it doesn't not mentioning how to use those new class code to test the map.

I might miss something here and not quite understand how these code help to debug/test Map issue. Could you point me to the right direction?

Thanks for the great resource,
Michael J.
10/7/2009 11:29 PM | Michael J.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: