The Visual Studio Test Runner requires Visual Studio Test Agent or Microsoft Visual Studio installed on the build agent.
On this page:
Visual Studio Tests runner settings
Test engine type
Select the tool used to run tests: VSTest or MSTest.
Test engine version
Select the version of the tool from the drop-down. By default, the available VSTest and MSTest installations are autodetected by TeamCity:
You can specify a custom path to the test runner here as well. TeamCity parameters are supported.
Test file names
This field is mandatory for VSTest and optional for MSTest.
Run configuration file
Additional command line parameters
Enter additional command line parameters for the selected test engine.
The rest of settings will vary depending on the engine to run tests with:
Select the platform bitness. Note that specifying x64 target platform will force the
If the default is specified, vstest.console will select the target framework automatically. You can also choose the .Net platform manually using the drop-down.
(optional) Of all tests discovered in the included assemblies, only the tests with the names matching the provided values will be run. For multiple values, use new line.
If the field is empty, all tests will be run. See details in the Microsoft documentation. Cannot be used with the option below.
Test case filter
Run tests that match the given expression. See details in the Microsoft documentation. Cannot be used with the option above.
Run in isolation
Run the tests in an isolated process
Use real-time test reporting
Custom test logger
VSTest.Console supports custom loggers, i.e. libraries that can handle events that occur when tests are being executed.
TeamCity 9.0+ has a custom logger that provides real-time test reporting.
The logger must be installed manually on the agent machine, as it requires dlls to be copied to the
Extensions folder of the VSTest.Console. No agent restart is needed when the custom logger is installed.
To install the custom logger:
- Download the custom logger
- Extract the contents of the downloaded archive on the agent machine:
for VisualStudio 2017 update 5 onwards - to PROGRAM_FILES(x86)\Microsoft Visual Studio\2017\<Edition>\Common7\IDE\Extensions\TestPlatform\Extensions
for VisualStudio 2017 up to update 4 - to PROGRAM_FILES(x86)\Microsoft Visual Studio\2017\<Edition>\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions
for VisualStudio 2015 - to PROGRAM_FILES\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions
for VisualStudio 2013 - to PROGRAM_FILES\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions
for VisualStudio 2012 - to PROGRAM_FILES\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions
Check that the custom logger was installed correctly by executing
vstest.console.exe /ListLoggersin the console on the agent machine. If the logger was installed correctly, you will see the logger with FriendlyName
Enter a value for
Testlist from metadata to run
Edit the Testlist. Every line will be translated into
Names of individual tests to run. This option will be translated into the series of
Run the test only if one unique match is found for any specified test in test section
Enter a value for the
To save the test run results to a named non-default file, enter a value for the