Command Line

Run tests in the command line

The vstest.console.exe is the command-line tool used by Visual Studio to run tests.

Using VSTest from a visual studio installation

Open a Developer Command Prompt, or you can find the vstest.console.exe in the Visual Studio installation folder, commonly found at:

%Program Files (x86)%\Microsoft Visual Studio\<version>\<edition>\Common7\IDE\CommonExtensions\Microsoft\TestWindow

Using VSTest from the TestPlatform package

Download the latest TestPlatform package from the Microsoft NuGet sitearrow-up-right and decompress it, you will find the vstest.console.exe at Tools\net451\Common7\IDE\Extensions\TestPlatform

This method can be useful to distribute a test Assembly with VSTest, which can test cases or reproduce issues on different machines without requiring a Visual Studio installation. The next layout shows the structure of a distributable folder.

📦MyDistributableFolder
 ┣ 📂TestPlatform
 ┃  ┣ 📂Common7
 ┃  ┗ 📂Team Tools
 ┗ 📂Test
    ┗ 📜myProject.Test.dll

Examples

To run the tests that use QualityMate that uses a .runsettingsfile, you will need to append the option /Settings:[FilePath]. to the VSTest executable, for example:

vstest.console.exe path\to\myProject.Test.dll /Settings:path\to\mySettings.runsettings

Multiple Assemblies can be used with the command below:

Filters can be used specify which test cases are going to run based on its traits such as [Priority] using the command:

For more information about the VSTest commands, you can find Microsoft's documentation about the vstest.console.exe options herearrow-up-right.

Last updated

Was this helpful?