Skip to main content
Many teams manage their test cases in a dedicated test case management system (TCMS) like Zephyr Scale, Xray, or TestRail while using Stably to author, run, and auto-heal their Playwright tests. This guide shows how to report Stably test results back to your TCMS so that QA leads and PMs see a unified view of test health. The approach depends on where your tests execute:

Option 1: Running in Your Own CI with Playwright

When you run stably test or npx playwright test in your own CI environment, Playwright executes locally and you have full control over reporter output. This is the simplest integration path because most TCMS tools — including Zephyr Scale — natively import JUnit XML.

Step 1: Add the JUnit Reporter

Add Playwright’s built-in JUnit reporter alongside the Stably reporter in your playwright.config.ts:
playwright.config.ts
This produces a standard junit-results.xml file after every test run, alongside streaming results to the Stably dashboard.

Step 2: Upload Results to Zephyr Scale

After tests complete, upload the JUnit XML to Zephyr Scale using their CLI or API. Here’s an example for GitHub Actions:
.github/workflows/stably-zephyr.yml
The --autoCreateTestCases flag (or autoCreateTestCases=true query parameter) tells Zephyr to automatically create test cases in your project for any test names it hasn’t seen before. This means you don’t need to manually pre-create every test case in Zephyr — they’re created on first import.

How Test Names Map to Zephyr

Playwright’s JUnit XML uses this naming structure:
Zephyr Scale uses the name attribute to match or create test cases. To keep things clean:
  • Use descriptive, stable test names in your Playwright tests
  • Avoid dynamically generated test names that change between runs
  • Use Playwright tags to organize tests, and map those to Zephyr folders or labels

Other TCMS Tools

The JUnit XML approach works with any TCMS that supports JUnit import:

Option 2: Running on Stably Cloud

When tests run on Stably Cloud, you don’t have direct access to the file system where tests execute, so you can’t grab a JUnit XML file. Instead, use the Stably REST API to retrieve structured test results and push them to your TCMS.
The Stably API requires an API key. Get yours from the API Key Dashboard.

Step 1: Trigger a Cloud Run and Get the Run ID

Trigger a run using any method — the Web Editor, CLI, API, or scheduled runs. All methods produce a runId you can use to fetch results.

Step 2: Poll for Results

Poll the run status until it completes:
Once the run finishes, the response includes detailed test results:
Possible test case statuses: PASSED, FAILED, TIMEDOUT, SKIPPED, INTERRUPTED, FLAKY.

Step 3: Push Results to Zephyr Scale

Write a script that maps Stably results to Zephyr’s test execution API. Here’s a complete example:
sync-to-zephyr.sh

Using stably runs for Richer Data

The stably runs view --json command provides more detailed results including error messages, attempt counts, and file locations — useful if your TCMS supports richer metadata:

Automating the Sync in CI

Add the sync script as a post-run step in your CI pipeline:
.github/workflows/stably-cloud-zephyr.yml

Mapping Test Statuses

Stably and Zephyr use different status vocabularies. Here’s how they map:
When using JUnit XML import, Zephyr automatically maps <testcase> (no failure element) to Pass and <testcase> with <failure> to Fail. Skipped tests use the <skipped/> element.

Best Practices

Use Stable Test Names

Your TCMS matches test cases by name. Avoid dynamically generated names that change between runs — this creates duplicate entries in Zephyr.

Run the Sync on Every CI Run

Automate the TCMS sync so results are always up to date. Don’t rely on manual uploads.

Use autoCreateTestCases

Let Zephyr auto-create test cases on first import. This avoids the overhead of manually creating entries for every Playwright test.

Keep One Source of Truth

Author and maintain tests in Playwright with Stably. Use the TCMS as a reporting and visibility layer, not as the place where test definitions live.

Next Steps

Stably Test Reporter

Stream results to the Stably dashboard for AI-powered debugging

API Reference

Full REST API documentation for programmatic access

Run Tests on Cloud

Execute tests on Stably’s cloud infrastructure

CI/CD Integration

Set up tests in your deployment pipeline