EditDescription
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.
EditUsage
Add to TFSBuild.proj
EditScript
<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>
EditNotes
- 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" />