TeamCity
 
You are viewing the documentation for an earlier version of TeamCity.

Visual Studio Tests

Last modified: 20 April 2023

The Visual Studio Tests runner integrates MSTest runner and VSTest console runner. Support for both frameworks enables TeamCity to execute tests and automatically import their test results.

The Visual Studio Test Runner requires Visual Studio Test Agent or Microsoft Visual Studio installed on the build agent.

Visual Studio Tests runner settings



The rest of settings will vary depending on the engine to run tests with:

VSTest Settings



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:

    1. Download the custom logger

    2. 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 /ListLoggers in the console on the agent machine. If the logger was installed correctly, you will see the logger with FriendlyName TeamCity listed:

      VSTest.TeamCityLogger.TeamCityLogger
      Uri: logger://TeamCityLogger
      FriendlyName: TeamCity{info}

MSTest settings