MSTest Support
TeamCity provides support for MSTest 2005-2015 testing framework via parsing of the MSTest results file (.trx file). The appropriate Microsoft Visual Studio edition installed on the build agent is required.
Due to specifics of MSTest tool, TeamCity does not support on-the-fly test reporting for MSTest. All test results are imported after the tests run has finished.
There are two ways to report test results to TeamCity:
Add the MSTest runner as one of your build steps. Since TeamCity 9.1, the MSTest runner is merged into the Visual Studio Tests runner.
Configure XML Report Processing via build feature or via service message to parse the .trx reports that are produced by your build procedure.
The easiest way to set up MSTest tests reporting in TeamCity is to add MSTest build runner as one of the steps to your build configuration and specify there all the required parameters. Please, refer to MSTest build runner page for details.
If the tests are already run within your build script and MSTest generates .trx reports, you can configure service messages to parse the reports.
Autodetection of MSTest
Prior to TeamCity 9.1 the MSTest location was reported as system properties: %\system.MSTest.8.0%
, %\system.MSTest.9.0%
,
%\system.MSTest.10.0%,
%\system.MSTest.11.0%,
%\system.MSTest.12.0%,
%\system.MSTest.14.0%
that referred to MSTest 2008
, 2010
, 2012
, 2013
, 2015
correspondingly.
Since TeamCity 9.1 system parameters of the %\system.MSTest.xx.yy%
format were changed to configuration parameters of the %\teamcity.dotnet.mstest.xx.yy%
format.
If system properties are required for the build, the mstest-legacy-provider plugin can be used.
TeamCity auto-detects MSTest based on the registry values that describe the Visual Studio installation path. If Visual Studio is installed in a non-standard location, or the registry key is corrupted, or the TeamCity agent has no access to the VisualStudio directory, TeamCity may not be able to detect MSTest. In this case, the corresponding configuration parameter of the %\teamcity.dotnet.mstest.xx.yy%
format must be added to the build manually. It should contain the full path including the MSTest.exe
executable, e.g. the default path for MSTest 2013 is C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe