docs: Improve usage of PublishTestResults for Azure Pipelines (#18241)

This commit is contained in:
Jacob Stevenson 2022-11-29 21:02:30 +00:00 committed by GitHub
parent 0c6a0f40c6
commit b7a49fb371
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -319,7 +319,7 @@ jobs:
npx playwright test npx playwright test
``` ```
This will make the pipeline run fail if any of the playwright tests fails. This will make the pipeline run fail if any of the playwright tests fails.
If you also want to integrate the test results with Azure DevOps, use `failOnStderr:false` and the built-in `PublishTestResults` task like so: If you also want to integrate the test results with Azure DevOps, use the task `PublishTestResults` task like so:
```yml ```yml
jobs: jobs:
- deployment: Run_E2E_Tests - deployment: Run_E2E_Tests
@ -337,13 +337,12 @@ jobs:
inputs: inputs:
workingDirectory: 'my-e2e-tests' workingDirectory: 'my-e2e-tests'
targetType: 'inline' targetType: 'inline'
failOnStderr: false failOnStderr: true
env: env:
CI: true CI: true
script: | script: |
npm ci npm ci
npx playwright test npx playwright test
exit 0
- task: PublishTestResults@2 - task: PublishTestResults@2
displayName: 'Publish test results' displayName: 'Publish test results'
inputs: inputs:
@ -353,6 +352,8 @@ jobs:
mergeTestResults: true mergeTestResults: true
failTaskOnFailedTests: true failTaskOnFailedTests: true
testRunTitle: 'My End-To-End Tests' testRunTitle: 'My End-To-End Tests'
condition: succeededOrFailed()
``` ```
Note: The JUnit reporter needs to be configured accordingly via Note: The JUnit reporter needs to be configured accordingly via
```ts ```ts