MSTest Plugin

Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID mstest Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
0.19 (archives)
Sep 01, 2015
emma (version:1.29)
junit (version:1.4)
Source Code
Issue Tracking
Pull Requests
Open Issues
Pull Requests
Ivo Bellin Salarin (id: nilleb)
Usage Installations 2014-Nov 2856
2014-Dec 2936
2015-Jan 3065
2015-Feb 3108
2015-Mar 3312
2015-Apr 3266
2015-May 3233
2015-Jun 3383
2015-Jul 3491
2015-Aug 3418
2015-Sep 3561
2015-Oct 3714

This plugin converts MSTest TRX test reports into JUnit XML reports so it can be integrated with Jenkin's JUnit features.

You can use MSTestRunner plugin or VsTestRunner plugin to run the test and use this plugin to process the results.

Code Coverage Support

Internally, the MSTest plugin uses code coverage information in the Emma XML file format, but it will automatically convert data in the Microsoft CoverageDS XML format to the Emma format. When using the Microsoft CoverageDS XML format, the coverage file must be named vstest.coveragexml and must be located in the same directory as the test results (.TRX) file. This is usually %workspace%\TestResults

In the unlikely case that you are somehow generating files in the Emma XML format, the coverage file must be named emma\coverage.xml and may be present anywhere in the workspace (in a directory named emma, as shown here)

Code Coverage Data Generation

The VSTestRunner Plugin allows you to specify a build step that includes code coverage generation. This plugin is usually configured to use the Microsoft VSTest.Console.exe application, which generates coverage information in a binary format must be converted to XML format before it can be used by the MSTest Plugin. This conversion is described below.

Code Coverage Data Conversion

To convert the binary VSTest.Console output to the Microsoft CoverageDS XML format, you may use one of the prebuilt applications referenced in the V0.14 release notes below, or you can build the following converter application:

    class Program
        static int Main(string[] args)
            if ( args.Length != 2)
                Console.WriteLine("Coverage Convert - reads VStest binary code coverage data, and outputs it in XML format.");
                Console.WriteLine("Usage:  ConverageConvert <sourcefile> <destinationfile>");
                return 1;

            CoverageInfo info;
            string path;
                path = System.IO.Path.GetDirectoryName(args[0]);
                info = CoverageInfo.CreateFromFile(args[0], new string[] { path }, new string[] { });
            catch (Exception e)
                Console.WriteLine("Error opening coverage data: {0}",e.Message);
                return 1;

            CoverageDS data = info.BuildDataSet();

            catch (Exception e)

                Console.WriteLine("Error writing to output file: {0}", e.Message);
                return 1;

            return 0;

The following Powershell build step will find one binary coverage data file in your workspace and convert it to XML format, assuming you use the default TestResults directory. (Modify as necessary to handle multiple coverage files)

Powershell build step for CoverageDS XML Conversion
$generatedCoverageFile = $(get-ChildItem -Path .\TestResults -Recurse -Include *coverage)[0]
CoverageConverter $generatedCoverageFile TestResults\vstest.coveragexml

Note: If you would like to convert the CoverageDS XML file to the Emma XML format, the procedure below is effective. This is not necessary for use of the MSTest Plugin, as it automates the generation of Emma XML data. This is provided for reference only:

This process requires the following tools:

The following powershell build step will perform the EMMA conversion:

Powershell build step for Emma XML conversion
if (test-path emma) { remove-item emma -recurse -force }
new-item -type container emma | out-null
$generatedCoverageFile = $(get-ChildItem -Path .\TestResults -Recurse -Include *coverage)[0]
CoverageConverter $generatedCoverageFile temp.xml
msxsl temp.xml "C:\path\to\MSTestCoverageToEmma.xsl" -o emma\coverage.xml
remove-item temp.xml

Can I use Microsoft's CodeCoverage.exe for data conversion?

Microsoft supplies C:\Program Files (x86)\Microsoft Visual Studio 1X.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe with Visual Studio. This does not produce the CoverageDS XML format, and is not compatible with the MSTest plugin. If you are interested in this topic, and you've some experience with XSL, there are a couple of transforms to convert back and forth in the github repository.

Change Log

Version 0.19 (September 1st, 2015)

  • Support for web tests (contacted by email, by Peter Barnes. No Jira issue has been opened)
  • Let the users still using Java 1.6 to continue using the plugin [JENKINS-29032]
  • Mark the inconclusive tests as 'skipped' [JENKINS-29316]

Version 0.18 (May 12th, 2015) --- !!! Java 1.7 is required !!!

  • Add support for "Retain long standard output/error" [JENKINS-28281]. The default value for this option is false. If you're automating the creation of your jobs, simply specify keepLongStdio=on as a parameter of your query. Any other value than 'on' will set this option to false.
  • Add localized messages for it, pt-BR, fr
  • Cumulated code coverage filename: vstest.coveragexml
  • Add default values for test result pattern and "fail if no result file is found": */.trx and true.

Version 0.17 (May 4th, 2015) --- !!! Java 1.7 is required !!!

  • Add a checkbox to ignore missing TRX files (Thanks Christopher Bush, pull request #7). The pull request contains also a way to automate job creation using the REST API. So, if you're automating the creation of your jobs, just specify failOnError=on to enable this feature. Any other value than 'on' will set this option to false.
  • Fix the code coverage calculations (Thanks junshanxu, pull request #6): a sum over all the nodes is better than using the value of the first node only.

Version 0.16 (Apr 14th, 2015) --- !!! Java 1.7 is required !!!

  • Show the code coverage graph for coveragexml files (one of the two XSD, the one produced by vstest)

Version 0.15 (Apr 14th, 2015) --- !!! Java 1.7 is required !!!

  • Improve support for data driven tests (Thanks, Darryl Melander: pull request #6)
  • Preserve charsets while fixing TRX files (JENKINS-23531, reopened by JitinJohn@MS)

Version 0.14 (Apr 1st, 2015)

  • Support for output/stdout messages (JENKINS-19384)
  • Drop invalid XML entities (JENKINS-23531). MSTest allows writing XML entities corresponding to invalid XML characters. These XML entities generate exceptions while being parsed by Java parsers. For me, it's still unclear if such entities are standard or not. However, to avoid these exceptions, the mstest parser simply drops them. These entities normally correspond to non printable characters.
  • Support for .coveragexml files. The coverage data present in these files is being transformed in an EMMA coverage report. Today, you can try to generate vscoveragexml files using or

Version 0.13 (Mar 18, 2015)

  • Support for ignored tests (JENKINS_27469)
  • Support for data driven tests (JENKINS-8193, JENKINS-4075)
  • Support for timed out tests (JENKINS-11332)
  • Support for TextMessages (JENKINS-17506)
  • Improved processing for tests whose @outcome is not set
  • Stacktraces are now shown as stacktraces, and error messages as error messages

Version 0.12 (Mar 12, 2015)

  • Convert MS XML code coverage reports in emma coverage reports, and show them.
  • Fix: the tests for which the outcome is 'error' (or missing, with an error message or a stack trace) will be reported as junit errors.

Version 0.11 (Jan 17, 2015)

  • Support vstest TRX format
  • Support environment variables as target (vstestrunner-plugin exports the full path to the TRX as environment variable)

Version 0.7 (Jun 17, 2011)

Version 0.6 (Feb 11, 2010)

  • Fixed issue JENKINS-3906: Durations greater than 59s
  • Fixed issue JENKINS-4632: MSTest plugin does not parse Visual Studio 2010 results

Version 0.5 (Feb 6, 2010)

  • Update code for more recent Hudson

Version 0.4 (Jun 16, 2009)

  • Fixed the AbortException issue
  • Added i18n support
  • Added Brazilian portuguese localization

Version 0.3

  • Indentifies test's class using the ExecutionId variable

Version 0.2

  • Fixed a problem to identify namespace and class name from the TestMethod tag
  • Changed JUnit test report file name

Version 0.1

  • Initial Release


plugin-report plugin-report Delete
plugin-dotnet plugin-dotnet Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Add Comment