Running BizTalk Unit Tests in a TFS Automated Build

 Since BizTalk 2009, BizTalk has had unit tests for Schemas, Maps and Pipelines.  I have recently been trying to incorporate these unit tests into my BizTalk Demo Project (instructions can be found here: http://msdn.microsoft.com/en-us/library/dd257907)

The test were working fine on my local development machine, but when I ran them as part of my TFS BizTalk automated build and test, they failed with the following error:

image

The error said: System.IO.FileNotFoundException: Could not find file ‘Microsoft.BizTalk.TOM.resources’.  So I searched the internet for the cause, I found several blog post that said to add a reference to the Microsoft.BizTalk.TOM.dll to my project, but that did not sound correct.

As part of running the wizard that create the test, it created a Local.testsettings, so I had a look at this file, in the host tab I found

image

This was the 1st clue I had to what was going wrong in the automated build, I then opened my Build Definition, in the Automated Tests settings under 2. Basic, I found that the TestSettings File was not specified, so I added the Local.testsettings file to my build definition.

image

I then queued another build for my BizTalk Demo Project and the unit testing now worked.

One other issue that I ran into with the BizTalk Unit Testing is that it requires files to be used as part of the testing and there is a difference in where the files are located between the local testing and the testing in the automated builds, soadded the following code to my test.

image

Notice that the difference is on the build server you need to add another level Sources.

Comments are closed.