Test: Publish Test Results
VSTS | TFS 2018 | TFS 2017 | TFS 2015
Publishes the test results to TFS or VSTS when tests are run using a runner of your choice.
The task supports popular test result formats including JUnit, NUnit 2, NUnit 3, Visual Studio Test (TRX), and xUnit 2. If you use the built-in tasks such as Visual Studio Test to run tests, results are automatically published and you do not need a separate publish test results task.
The build agent must have the following capabilities:
- Azure PowerShell
# Publish Test Results # Publish Test Results to VSTS/TFS - task: PublishTestResults@2 inputs: #testRunner: 'JUnit' # Options: jUnit, nUnit, vSTest, xUnit #testResultsFiles: '**\TEST-*.xml' #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional #mergeTestResults: false # Optional #testRunTitle: # Optional #platform: # Optional #configuration: # Optional #publishRunAttachments: true # Optional
|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, Visual Studio Test Results (TRX)
- Version 2 of the task: JUnit, xUnit 2, NUnit 2, 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 (
- Version 2 of the task: Uses the minimatch patterns. For example,
|Search folder||Available only in version 2 of the task. Folder to search for the test result files. Default is
|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,
|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|
This task is open source on GitHub. Feedback and contributions are welcome.