Geeks With Blogs
David Blomqvist

This is a short description on how to set up BizTalk 2009 project with automated build and testing.


The build server setup

First, before we start running automated build and tests we need to setup our build server with the tools necessary. Log on to your build server and install the following parts of BizTalk 2009:

·          Additional Software / Project Build Component
(needed to building the project)

·          Developer Tools and SDK
(needed to run tests)



Setting up the build

Set up a new build for your project, follow the normal procedures for that there is nothing special for BizTalk projects here.

Queue a new build from your build definition and check if it builds ok.


Setting up automated tests

Open project properties on the bBizTalk project (right-click the project choose properties) and go to the deployment tab, enable unit testing.



Now add a test project to your solution.

In the new project, add references to: 

  • Your main project
  • Microsoft.BizTalk.TestTools (contains the test tools)
  • Microsoft.XLANGs (it will not run without these)



Testing a map

Now we can start writing unit test. Below I will show two simple test types, for a schema and for a map.


public void TestMap()


    Microsoft.BizTalk.TestTools.Mapper.TestableMapBase map = new MyBTS2009TestProject.Map_Msg1_Msg2();


        @"myTestMsg1 - Correct.xml",





    bool filesIdentical = CompareFiles(


        "Mapoutput - Expected Result.xml");





Testing a schema


public void TestSchema()


    Microsoft.BizTalk.TestTools.Schema.TestableSchemaBase schema = new MyBTS2009TestProject.Msg1();

    bool result = schema.ValidateInstance(

        @"myTestMsg1 - Correct.xml",







public void TestSchemaInvalidInstance()


    Microsoft.BizTalk.TestTools.Schema.TestableSchemaBase schema = new MyBTS2009TestProject.Msg1();

    bool result = schema.ValidateInstance(

        @"myTestMsg1 - Error.xml",






Note that we use a couple of files in the code above. We will need to setup a few things for this to work correctly with unit testing. Both locally and with the automated build.

In the Solution Explorer, under Solution Items, double-click the run configuration file that you want to edit. And then click “Deployment”. Use “Add directory” to add the testdata directory. This will give you access to all the files in the folder when running tests.




This is enough for local testing but it will not run correctly on the build server. To fix that we need to open the build file.

In a property group section( <PropertyGroup> ) add this:


You could use another testrunconfig that your local one the server, and you probaly will sooner or later but for now it is ok with this one.

And we also need to add the information below, to tell MSBuild run our tests and where to find them. We could also use a testlist but for now we just tell MSBuild to run all test in our assemblies called *.Test.dll

Add this to an item group section( <ItemGroup> )

    <TestContainer Include="$(OutDir)\%2a.Test.dll" />


You can now queue a new build again and check if your tests runs correctly.



Posted on Thursday, June 4, 2009 4:30 PM BizTalk Server | Back to top

Comments on this post: Automated build and test with BizTalk Server 2009

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © blomqvist | Powered by: