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, available since TeamCity 9.1, integrates MSTest runner and VSTest console runner formerly provided as an external plugin. The Visual Studio Tests runner provides support for both frameworks enabling TeamCity to execute tests and automatically import their test results.

Prior to TeamCity 9.1.5, the runner requires the appropriate Microsoft Visual Studio edition installed on the build agent. Since TeamCity 9.1.5, the Visual Studio Test Runner supports Visual Studio Test Agent installed on the agent machine (Microsoft Visual Studio is no longer required).

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 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