Saturday, September 13, 2008

<TestContainer> Works With WebTest & LoadTest In Team Build 2008 With SP1

Published on: http://vstskb.net/blog/2008/09/testcontainer-works-with-webtest-loadtest-team-build-2008-with-sp1/

The new <TestContainer> item in Team Build 2008 in a great way to run tests without test metadata file (*.vsmdi).

You can specify the following to run all unit tests found in assemblies matching the pattern *.Tests.dll and even specify .LoadTest and .WebTest files as well:

<ItemGroup>
<TestContainer Include="$(Outdir)*.Tests.dll" />
<TestContainer Include="$(Outdir)WebTest1.webtest" />
<TestContainer Include="$(Outdir)LoadTest1.loadtest" />
</ItemGroup>


But if you try to run it in Team Build 2008, you will get an error like: Could not load file or assembly.



That's because the task tries to do an Assembly.LoadFrom() on whatever files you include in the <TestContainer> item. This obviously fails because .LoadTest and .WebTest are XML files, not assemblies.



This problem has been solved in TFS 2008 SP1. All you need to do is to apply the TFS SP1 patch to the build machine (If you don’t want, it’s not necessary to install TFS SP1 on TF Server to get the fix).

No comments: