MsTest is a nice testing framework. However it can be annoying from time to time. a while ago in the past I’ve blogged about the inability of this testing framework to execute all tests in a given sln file.
Recently i had some time and I decided thats its about time that ill do something productive about this (instead of my usual complaining) and I’ve sat down to write a simple msbuild task that runs all tests in a solution.
here is an example of a build script that uses this task:
<UsingTaskAs you can see you just tells it which mstest version to use, the solution file containing the test you want to execute and any additional parameters if needed.
TaskName="RunAllTestsInSolution"
AssemblyFile="RunAllTestsInSolution.dll" />
<PropertyGroup >
<MSTestLocation>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE</MSTestLocation>
</PropertyGroup>
<Target Name="UnitTestsWithCoverage">
<RunAllTestsInSolution
MSTest ="$(MSTestLocation)\mstest.exe"
SolutionFile="Example.sln"
Parmaters ="/resultsfile:TestResults.trx" />
</Target>
You can download the source code from here.


8/15/2010
Posted in:

0 comments:
Post a Comment