Team Foundation Build Recipes

Running Unit Tests without a Test List

Modified: 2008/02/28 18:53 by admin - Categorized as: Team Build Recipes
Edit

Description

This recipe is useful when you have a large suite of unit tests and you don't want to be burdened with maintaining Test List (*.vsmdi) files.

This works out of the box on a TFS 2008 Team Build.

However, there is a problem if you want to run the script as a Desktop Build (Walkthrough: Configuring and Using a Desktop Build). The bug in Team Build 2008 is detailed on Connect.

Edit

Usage

Add to TFSBuild.proj

Edit

Script

    


<Target Name="BeforeTestConfiguration">

    <Message Text="Using unit tests from: $(BinariesRoot)\$(Configuration)\*.Tests.dll"
             Condition=" '$(IsDesktopBuild)'=='true' " />

    <CreateItem Include="$(BinariesRoot)\$(Configuration)\*.Tests.dll">
     <Output TaskParameter="Include" ItemName="LocalTestContainer"/>
     <Output TaskParameter="Include" ItemName="TestContainer"/>
    </CreateItem>

    <Message Text="LocalTestContainer: @(LocalTestContainer)"
             Condition=" '$(IsDesktopBuild)'=='true' " />

</Target>


Edit

Notes

  • Currently it matches all *.Tests.dll outputs in the \Binaries\Release\ folder. If your test assemblies are named differently, you will need to update this.
  • It might be useful to store this workaround in a TestContainerWorkaround.targets file, then add an <Import Project="TestContainerWorkaround.targets" />

© 2008 William Bartholomew blog.bartholomew.id.au

Powered by screwturn wiki