PublishTestResults@1 - Publish test results v1 task

Publish test results to Azure Pipelines.

Publish Test Results to VSTS/TFS.

Syntax

# Publish test results v1
# Publish test results to Azure Pipelines.
- task: PublishTestResults@1
  inputs:
    testRunner: 'JUnit' # 'JUnit' | 'NUnit' | 'VSTest' | 'XUnit'. Required. Test Result Format. Default: JUnit.
    testResultsFiles: '**/TEST-*.xml' # string. Required. Test Results Files. Default: **/TEST-*.xml.
    #mergeTestResults: false # boolean. Merge Test Results. Default: false.
    #testRunTitle: # string. Test Run Title. 
  # Advanced
    #platform: # string. Platform. 
    #configuration: # string. Configuration. 
    #publishRunAttachments: true # boolean. Upload Test Attachments. Default: true.
# Publish Test Results v1
# Publish Test Results to VSTS/TFS.
- task: PublishTestResults@1
  inputs:
    testRunner: 'JUnit' # 'JUnit' | 'NUnit' | 'VSTest' | 'XUnit'. Required. Test Result Format. Default: JUnit.
    testResultsFiles: '**/TEST-*.xml' # string. Required. Test Results Files. Default: **/TEST-*.xml.
    #mergeTestResults: false # boolean. Merge Test Results. Default: false.
    #testRunTitle: # string. Test Run Title. 
  # Advanced
    #platform: # string. Platform. 
    #configuration: # string. Configuration. 
    #publishRunAttachments: true # boolean. Upload Test Attachments. Default: true.

Inputs

testRunner - Test Result Format
string. Required. Allowed values: JUnit, NUnit, VSTest, XUnit. Default value: JUnit.

Specifies the format of the results files you want to publish. The following formats are supported: CTest, JUnit, NUnit 2, NUnit 3, Visual Studio Test (TRX) and xUnit 2.


testResultsFiles - Test Results Files
string. Required. Default value: **/TEST-*.xml.

Specifies one or more test results files.

  • 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. If using VSTest as the test result format, the file type should be changed to .trx e.g. **/TEST-*.trx
  • Multiple paths can be specified, separated by a new line.
  • Additionally accepts minimatch patterns.

For example, !TEST[1-3].xml excludes files named TEST1.xml, TEST2.xml, or TEST3.xml.


mergeTestResults - Merge Test Results
boolean. Default value: false.

When this boolean's value is true, the task reports test results from all the files against a single test run. If the value is false, the task creates a separate test run for each test result file.

Note

Use the merge test results setting to combine files from the same test framework to ensure results mapping and duration are calculated correctly.


testRunTitle - Test Run Title
string.

Optional. Specifies a name for the test run against which the results will be reported. Variable names declared in the build or release pipeline can be used.


platform - Platform
string.

Optional. Specifies the build platform against which the test run should be reported. For example: x64 or x86. If you defined a variable for the platform in your build task, use it here.


configuration - Configuration
string.

Optional. Specifies the build configuration against which the test run should be reported. For example: Debug or Release. If you defined a variable for the configuration in your build task, use it here.


publishRunAttachments - Upload Test Attachments
boolean. Default value: true.

Optional. When this boolean's value is true, the task uploads all the test result files as attachments to the test run.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

PublishTestResults@2 is a newer version of this task that provides NUnit3 support and support for Minimatch files patterns.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.144.0 or greater
Task category Test
Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.83.0 or greater
Task category Test

See also