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 in my series of articles about testing with BizTalk I covered a technique for testing pipelines and pipeline components. 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:

Pipeline Components - http://geekswithblogs.net/michaelstephenson/archive/2008/03/30/120852.aspx

Pipelines - http://geekswithblogs.net/michaelstephenson/archive/2008/03/30/120853.aspx

In this post although we could do testing of pipelines and pipelines components using the excellent pipeline component test library. While that component is excellent for testing, I think the new model provides a simpler option and to be honest with Pipeline Component Test Library it sometimes took a little bit of fiddling with setting up the pipeline wrappers to get your test to work. My gut feeling is that the new approach will just be that bit more straightforward.

I will extend on the sample from the previous post about testing schemas. So our solution now looks like the below picture containing a pipeline

  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. You would also need to add references to the pipeline assemblies highlighted in the below picture

 

  1. The test code

In the below code you can see that I will construct an instance of the TestableReceivePipeline which is what my custom receive pipeline will derive from. I can then provide documents and schema information and then execute my pipeline. Unfortunately the documentation of these objects doesn't seem to be complete in the initial CTP so Im guessing there are a few more ways you can configure these objects, but they will give you an easy way to test send and receive pipelines.

  1. What about Pipeline Components

In the Pipeline Component Test Library there was the ability to be able to construct a pipeline wrapper in code so you could simulate adding your custom pipeline component to different types of pipeline. I'm not sure that you can do this in the new features of BizTalk 2009, however you can just create a pipeline artefact and add your component to that. The other cool feature is you might not (haven't tried this) even have to add a new project for the BizTalk artefact as you can have BizTalk and C# files in the same project.

Summary

As you can see this new technique appears like it will be a simpler way to encourage testing.

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

If you have problems accessing it then let me know.

Posted on Friday, December 12, 2008 1:33 AM BizTalk Testing | Back to top


Comments on this post: BizTalk Testing Series – Testing Pipelines and Pipeline Components in BizTalk 2009

# testing default pipelines
Requesting Gravatar...
how do i go about testing the default pipelines with the new testing features of biztalk the problem that i see is that the default pipelines dont inheritt from the TestableReceivePipeline
Left by nen on Jan 22, 2009 8:55 AM

# re: BizTalk Testing Series – Testing Pipelines and Pipeline Components in BizTalk 2009
Requesting Gravatar...
Does BizTalk server 2009 provide support for SFTP. Any pointers would be helpful

Regards,
Sundar
Left by Sundar on Apr 23, 2009 9:35 PM

# re: BizTalk Testing Series – Testing Pipelines and Pipeline Components in BizTalk 2009
Requesting Gravatar...
Hi..

Do you have any experience using Unit testing pipeline for flat file schema which has header schema and trailer schema?

I tried to do unit testing for that but always fail.

Regards,
Ngurah
Left by Ngurah on Sep 01, 2009 10:31 AM

# re: BizTalk Testing Series – Testing Pipelines and Pipeline Components in BizTalk 2009
Requesting Gravatar...
I am trying to set properties of the pipeline and I am using the Pipeline.Configure method. It takes a parameter of XmlReader. I have tried setting this to the pipeline data xml (<Root><Stages>.... etc.) and I do not receive and error. I really do not see any other property or method to set the pipeline properties. In any event this is not working properly. I added a debug assertion right before calling the TestPipeline method, attached my pipeline component code to the vshost process hosting the pipeline, and clicked ignore. The pipeline component properties are not being set. Do you know or have any advise on setting these properties?

Regards,
Ted
Left by Ted on Jan 18, 2010 7:35 AM

# re: BizTalk Testing Series – Testing Pipelines and Pipeline Components in BizTalk 2009
Requesting Gravatar...
I am sure this is a rookie mistake, but when I try to compile the test project in the downloaded source, the compiler "Cannot resolve symbol 'Acme'". Can you suggest where my configuration problem is? Thank you.
Left by Skip Sailors on Feb 26, 2010 11:07 AM

# re: BizTalk Testing Series – Testing Pipelines and Pipeline Components in BizTalk 2009
Requesting Gravatar...
Sorry, it is a rookie mistake. My refactoring tool is giving me a false negative on that symbol. Never mind.
Left by Skip Sailors on Feb 26, 2010 11:25 AM

# re: BizTalk Testing Series – Testing Pipelines and Pipeline Components in BizTalk 2009
Requesting Gravatar...
Can we test EDI schemas following any of the two testing methods? I am trying to find a way to Unit Test pipeline components with out having to deploy the pipeline components to Biztalk server. So far it is a failure.

-Thanks
Chakri
Left by Chakri on Apr 20, 2010 5:25 PM

# re: BizTalk Testing Series – Testing Pipelines and Pipeline Components in BizTalk 2009
Requesting Gravatar...
EDI schemas should be able to be tested as described, however they are usually complex and tough to challenge

For pipeline components refer to the article in the series about testing pipeline components using pipeline component test library which allows you to test them without deployment to BizTalk
Left by Mike on Apr 20, 2010 6:19 PM

# CatSkill Infra Projects Pvt. Ltd.
Requesting Gravatar...
nicly post...
Left by rajni on Jan 06, 2011 4:41 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Stephenson | Powered by: GeeksWithBlogs.net