In my last post, I explained how to implement unit testing for schemas and maps in a BizTalk Server 2013 project using Visual Studio 2012. I also mentioned an issue that occurs when testing maps. Every time the unit test runs, Visual Studio throws the following error:
- Microsoft.BizTalk.TestTools.BizTalkTestAssertFailException: Transform Failure.
Until Microsoft releases a hotfix (likely in a future CU), my previous post described a workaround. The solution used a custom wrapper class based on Microsoft.BizTalk.TestTools.dll.
However, Paul Nichols from Mexia pointed me to a post by Michael Stephenson (BizTalk 2013 Map Unit Testing Gotcha). It suggested using a Test Settings file to force tests to run in 32-bit mode. This approach avoids the need for a custom assembly. I decided to try it.
📝 One-Minute Brief
You can fix the BizTalk 2013 map unit testing “Transform Failure” error by adding a .testsettings file to the Visual Studio test project and running tests in 32-bit mode. This workaround eliminates the need for a custom wrapper assembly.
Understanding .runsettings vs .testsettings
Unit tests in Visual Studio 2012 can be configured by using a .runsettings file (.runsettings is new in Visual Studio 2012 – if you’re familiar with unit testing in previous versions of Visual Studio, you might know about .testsettings files). For example, you can change the .NET Framework on which the tests will be run, the directory where test results are delivered, and the data collected during a test run.
You can still use .testsettings in Visual Studio 2012, so any test configurations you wrote for previous editions will still work. But .testsettings can be used only to configure tests written for the MSTest adapter. By contrast, .runsettings can be used with any of the adapters built for the extensible unit test framework in Visual Studio 2012, such as xUnit.net and NUnit.
You still need a .testsettings file for some kinds of tests:
- Tests that are deployed in a lab environment.
- Web performance and load tests.
- Customizing some types of diagnostic data adapters, such as IntelliTrace and enterprise logging.
- BizTalk Server maps (workaround).
Maps Unit Testing Workaround 2 (add .testsettings file)
Unfortunately, if we add a .runsettings file and force the tests to run in 32-bit mode, see an example of this Test Settings file here, our test project still doesn’t work!
However, when I used a .testsettings file — either copied from a Visual Studio 2010/BizTalk Server 2010 solution or created inside the BizTalk Server 2013 solution — the tests worked. I cannot fully explain why, but it consistently fixes the problem.
How to Fix the Error
So to accomplish this, we need to:
- Right-click on the BizTalk solution name: Solution ‘UnitTestingFeatureWithMaps’ (2 projects), and select Add and then New Item…
- In the Add New Item – Solution Items dialog box, expand Installed and then choose Test Settings.
- From the list of items, select Test Settings.
- In the Name box, enter TestSettings.testsettings, and then click Add.
- This will open a new window for us to specify the settings of the test settings file. Just leave the default setting by clicking Close.
You can add more than one test settings file if you want to be able to switch quickly between different settings.
- On the Visual Studio main menu, choose Test, choose Test Settings, and then choose Test Settings File.
- In the Open Setting File window, select the test setting file that we previous create: TestSettings.testsettings.
So if we perform the tests again, we will notice that the Microsoft.BizTalk.TestTools.BizTalkTestAssertFailException: Transform Failure is solved, and the only error that is happening is about a Map output validation failure (intentionally present)
Thank you, Paul Nichols, for your comments.






I’m glad there’s a simple solution to a terrible exception which really gives you no clue about what’s wrong
Hi Admin! Nice Blog very informative (Y)
I have a suggestion -please improve the design of blog, for a beginner start from very first blog post is tough so make it navigable by page nnumber.
Thanks
Rahul