This is a mirror of official site: http://jasper-net.blogspot.com/

HowTo: Open MSTest with MSBuild

| Sunday, November 28, 2010
According to the blogpost about „HowTo: build solutions with MSBuild“ I’m going to show you a little example about how to call MSTests.

Scenario

The structure is nearly the same like in this blogpost. As a little add-on I created a new test project:

I’ve added one more “RunTests” target to my BuildSolutions.target file where the MSBuild Script is included:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">

<PropertyGroup>
<OutDir>$(MSBuildStartupDirectory)\OutDir\</OutDir>
<SolutionProperties>
OutDir=$(OutDir);
Platform=Any CPU;
Configuration=Release
</SolutionProperties>
</PropertyGroup>
<ItemGroup>
<Solution Include="..\MsBuildSample.sln">
<Properties>
$(SolutionProperties)
</Properties>
</Solution>
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="@(Solution)"/>
</Target>
<Target Name="RunTests">
<Exec Command='"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" /testcontainer:"$(MSBuildStartupDirectory)\OutDir\MsBuildSample.WebApp.Tests.dll" /testcontainer:"$(MSBuildStartupDirectory)\OutDir\AnotherTestProject.dll"' />
</Target>
</Project>

Read more: Code-Inside Blog International

Posted via email from .NET Info

0 comments: