All posts

Publishing Playwright test results in Azure DevOpsPublishing Playwright test results in Azure DevOps

Polski

Publishing Playwright test results in Azure DevOps

See Playwright failures clearly in Azure DevOps: publish test results in a standard format so the pipeline shows what broke, and shape the job so reporting stays useful when a run goes red, alongside the parallel Cypress test-results article.

Test automationPlaywrightCIAzure DevOps

Introduction

The Cypress Azure reporting post wired Mocha’s junit reporter into Publish Test Results. Playwright ships the same capability natively - configure reporter once and point Azure at the XML file.

Previous post: Playwright CI on Azure.

Reporter in playwright.config.ts

import { defineConfig } from "@playwright/test"

export default defineConfig({
  reporter: [
    ["list"],
    ["junit", { outputFile: "results/e2e-junit.xml" }],
  ],
})

One-off CLI runs are possible, but checking the reporters into config keeps local and CI behaviour aligned.

Azure: run + publish

Same pattern as Cypress: mark the test step with continueOnError: true so the pipeline reaches publishing, then let Publish Test Results fail the job when failTaskOnFailedTests sees red tests.

  - script: npx playwright test
    continueOnError: true
    displayName: Run Playwright tests

  - task: PublishTestResults@2
    inputs:
      testResultsFormat: JUnit
      testResultsFiles: "**/e2e-junit.xml"
      failTaskOnFailedTests: true
      testRunTitle: Playwright tests

Publish Test Results (asset from the Cypress series)

Why bother

Azure aggregates JUnit-compatible output regardless of whether Cypress or Playwright produced it - only the runner command changes.

Cypress reference

https://github.com/12masta/react-redux-realworld-example-app/tree/8-cypress

Full Cypress + JUnit walkthrough: cypress-9.

That finishes the parallel Playwright track (playwright-1playwright-9) alongside the original Cypress posts.