Uploading MsTest results to TFS

At Info Support we have been building and maintaining an automated build process over the last six years. This process is largely based on NAnt and has a lot of custom code.

When Team System was released, we started upgrading our build to use the Team System Version Control environment instead of Visual SourceSafe. Furthermore we integrated our build into TFS by writing custom tasks to register builds with Team System and log information with team System during the build. This way we’re able to keep our existing custom build environment (that provides much more features then the default TeamBuild with Team System does) and still provide the full TFS experience with Visual Studio.

 

In our automated build process we’ve been using NUnit to execute unit tests. This tool has been the defacto standard for quite some years and is fairly easy to use. However, with the launch of Team System Microsoft released their own test engine called MsTest. Now that MS released the test tools also in the Professional SKU we wanted to support MS test as well in our build. To remain backwards compatible, we’ve decided to extend our build to support both NUnit and MsTest.

I have been working on this feature for some days and kept running into the same problem. Running the MsTest tests locally turned out to be very simple. The problems started when I tried to upload the test results back to Team System. I kept on getting the error:

 

Publish Failed. Test Type not installed on the server for test type: "Microsoft.Samples.VisualStudio.TestTools.HostAdapters.VsIde.RunConfigData".

 

As it turns out this issue only appears with solutions that were opened on a machine were the Microsoft Visual Studio 2005 SDK is installed.
Searching the internet I found this comment on the Microsoft connect site, provided by the VS SDK team:

 

In case you build VS packages, you have to have VS SDK installed. This is the main purpose of VS SDK. If you do not need to extend VS with the new packages, please uninstall the VS SDK and the problem will go away. It is by design of the Test project to persist all the registered host types in the test run config file and VS SDK installs the VS IDE Host Adapter.

Unfortunately uninstalling the SDK is not an option for us as we do extend Visual Studio. I realized though, that when this information is put into the test run config file, the information is not mandatory. It should be possible to delete this information, without breaking the test run config file.

We ended up building a very simple MsBuild task that will scan the test run config file before the tests are executed and delete the hostData element in the test run config file.

 

Hope this helps,