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 Custom .net Components

This post aims to provide some general guidance on testing for .net components which will be used within a BizTalk project.  In terms of .net components I am mainly talking about the following:

  • .net helper classes used by orchestrations
  • .net classes used within Maps

I have done seperate posts in this series (or am planning) which covers the following types of .net component which has more specific testing requirements:

  • Custom Pipeline Components
  • Custom Adapters

Some recommendations to help you with this testing includes:

1. The key thing with .net helper type components is that they should be tested exactly in the same way you would test any normal C# code.  You would use MsTest or NUnit style tests and should use a code coverage tool to help ensure you test all cases.

2. It is a good practice to abstract the logic of a component from the reliance on any BizTalk objects which may make the component more complicated.  This can be handled using something like the facade pattern.  Testing would be simplified because you could unit test all of the logic and then just have fairily simple code at the interface to the component.

3. You may also want to use something like the Rhino Mocks framework to help when you have a class which has dependancies on the BizTalk objects.  An example of this might be a class where you pass in an XLANGMessage or IBaseMessage.  Normally these are difficult to test but Rhino Mocks allows you to create a dynamic mock representing the XLANGMessage object which you can now use to test with.

4. Ensure your tests are part of your continuous integration process

5. Ensure you monitor code coverage

 

Source: http://www.geekswithblogs.net/michaelstephenson

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

Print | posted on Sunday, March 30, 2008 12:20 AM | Filed Under [ BizTalk BizTalk Testing ]

Feedback

Gravatar

# re: BizTalk Testing Series - Testing Custom .net Components

Invaluable. Thank you
6/2/2009 8:21 PM | Keith
Gravatar

# re: BizTalk Testing Series - Testing Custom .net Components

Other tips for testing .NET classes used by BizTalk:

1. Test that complex methods are thread safe. You can use the ThreadTester library to help do this (see: http://weblogs.asp.net/rosherove/archive/2007/06/22/multi-threaded-unit-tests-with-osherove-threadtester.aspx).

2. Ensure your unit tests run on the same version of windows as your production servers. For example, the classes XmlSchema and XmlSchemaSet are "less" thread safe on 64bit servers (see: http://blogs.msdn.com/marcelolr/archive/2009/03/16/xmlschema-and-xmlschemaset-thread-safety.aspx).
11/13/2009 1:26 PM | Charlie Mott
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: