Test: Publish Test Results

Last Update: 5/18/2017

Team Services | TFS 2017 | TFS 2015 | Previous versions: XAML Build, Release

icon Publishes the test results to TFS or Team Services when tests are run using a runner of your choice.

The task supports popular test result formats including JUnit, NUnit 2 sample XML XSD, NUnit 3, Visual Studio Test (TRX), and xUnit 2. If you use the built-in tasks such as Visual Studio Test or Run Functional Tests to run tests, results are automatically published and you do not need a separate publish test results task.

Demands

The build agent must have the following capabilities:

  • MSBuild
  • Azure PowerShell

Arguments

Argument Description
Test result format Specify the format of the results files you want to publish. The following formats are supported.
- Version 1 of the task: JUnit, xUnit 2, NUnit 2 sample XML XSD, Visual Studio Test Results (TRX)
- Version 2 of the task: JUnit, xUnit 2, NUnit 2 sample XML XSD, NUnit 3, Visual Studio Test Results (TRX)
Test results files Use this to specify one or more test results files.
- Version 1 of the task: You can use a single-folder wildcard (*) and recursive wildcards (**). For example, **/TEST-*.xml searches for all the XML files whose names start with TEST- in all subdirectories. Multiple paths can be specified, separated by a semicolon.
- Version 2 of the task: Uses the minimatch patterns. For example, **/TEST-*.xml searches for all the XML files whose names start with TEST- in all subdirectories.
Search folder Available only in version 2 of the task. Folder to search for the test result files. Default is $(System.DefaultWorkingDirectory)
Merge test results When this option is selected, test results from all the files will be reported against a single test run. If this option is not selected, a separate test run will be created for each test result file.
Test run title Use this option to provide a name for the test run against which the results will be reported. Variable names declared in the build or release process can be used.
Advanced - Platform Build platform against which the test run should be reported. For example, x64 or x86. If you have defined a variable for the platform in your build task, use that here.
Advanced - Configuration Build configuration against which the Test Run should be reported. For example, Debug or Release. If you have defined a variable for configuration in your build task, use that here.
Advanced - Upload test results files When selected, the task will upload all the test result files as attachments to the test run.
Control options See Control options

More Information

Q&A

I use Team Foundation Server on-premises and I don't see some of these features. Why not?

Some of these features are available only on Visual Studio Team Services and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.

Help and support