- Open up the Developer Command Prompt for VS.
- Type
where vstest.console
- Type
where msbuild
- Add the directory paths of each to the PATH environmental variable.
Now we can run both VSTest and MSBuild from a normal shell. Here is an example with PowerShell:
cd MyTests
msbuild MyTests.csproj
vstest.console bin\Debug\MyTests.dll
We can run tests by wildcard...
vstest.console bin\Debug\MyTests.dll
/TestCaseFilter:FullyQualifiedName~Foobar
...or by name
vstest.console bin\Debug\MyTests.dll
/Tests:TestMethod1,TestMethod2
... or by TestCategoryAttribute.
vstest.console bin\Debug\MyTests.dll
/TestCaseFilter:"TestCategory=Dev"
See also: https://msdn.microsoft.com/en-us/library/jj155800.aspx
Questions? Ping me @shaunluttin on Twitter.