Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
The MSTest task is designed to run tests written with the test framework integrated into Microsoft Visual Studio. This test framework is commonly referred to as MSTest.
How to use the MSTest Task
Because the MsTest executable location varies between versions of Visual Studio and platform (x86 / x64) it is necessary to specify the location of mstest.exe. This is done by setting the 'command' instance variable of the configuration object. In addition to command, the assemblies variable must also be set to specify the DLL(s) which include MSTest tests.
desc "MSTest Test Runner Example" mstest :mstest do |mstest| mstest.command = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" mstest.assemblies "output/YourProject.Tests.dll" end
Note that MStest is installed to the following locations by default:
- VS2008 / x86: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe
- VS2008 / x64: C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe
- VS2010 / x86: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe
- VS2010 / x64: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe
- VS2012 / x86: C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe
- VS2012 / x64: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe
This task supports additional command line options, including a
.parameters collection for passing in options that are not directly supported. For more information, see the commandline task options documentation. MSDN has good documentation of all the command-line options for MSTest.