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

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

Posted on Sunday, March 30, 2008 12:20 AM BizTalk , BizTalk Testing | Back to top


Comments on this post: BizTalk Testing Series - Testing Custom .net Components

# re: BizTalk Testing Series - Testing Custom .net Components
Requesting Gravatar...
Invaluable. Thank you
Left by Keith on Jun 02, 2009 8:21 PM

# re: BizTalk Testing Series - Testing Custom .net Components
Requesting Gravatar...
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).
Left by Charlie Mott on Nov 13, 2009 1:26 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Stephenson | Powered by: GeeksWithBlogs.net