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

A while back I wrote a couple of posts about Testing maps in BizTalk. They are at the following links:

BizTalk 2006 R2

BizTalk 2009

One possible extension to this might be if you have a map which rather than using the map designer imports a custom XSLT to perform the mapping. (If you are not familiar with this refer to MSDN).

So if you have a custom XSLT then you really have a couple of choices with regard to testing it. The first choice is that you can just run the testing approaches which are described above, or you could also test the XSLT before you use it in the BizTalk map or do both.

If you wish to test the XSLT in isolation you can use the XslCompiledTransform class within the System.Xml.Xsl namespace. This will allow you to load the xsl and then transform an input file to an output file like in the below example. You could then perform a binary comparison on the output file against what it is expected to look like.




So you can see above this is easy to do. I would probably in practice do 1 test which would test the BizTalk map to ensure it works correctly when loading the custom XSLT and the rest of my tests will focus on testing the XSLT in isolation and testing different cases within the map.

Posted on Thursday, July 9, 2009 4:31 AM BizTalk , BizTalk Testing , blogdoc | Back to top

Comments on this post: Testing BizTalk Maps with Custom XSLT

# re: Testing BizTalk Maps with Custom XSLT
Requesting Gravatar...
Using XSLT in Biztalk, iam new to biztalk development , can anyone suggest which is better (functiods/maps get translated into xslt at code behind) do we need to alter xslt or try using maping.

Left by prashanthspark on Aug 18, 2009 4:37 AM

# re: Testing BizTalk Maps with Custom XSLT
Requesting Gravatar...
for many scenarios you will find the biztalk mapper is adequate for your needs, however on occasion you will come across a scenario which the mapper doesnt support out of the box.

In this case you can create a BizTalk map and then rather than draw mappings on it use the maps property which points to an external xslt file. This is then "sucked" into the map at compile time and executes as if it were a normal map on a port or in an orchestration.

My normal process for doing this is to create a map which does most of what i need, then get the underlying xslt and copy it to a seperate file which i then modify by hand

Left by Mike on Aug 18, 2009 6:20 PM

Your comment:
 (will show your gravatar)

Copyright © Michael Stephenson | Powered by: