Playwright File Reporters
Playwright File Reporters
File reporters save the test results to a file, for other tools to read.
CI servers (machines that run your tests automatically, see CI) use them to show test results and to merge reports from several machines.
The examples run the four tests in tests/practice.spec.js from the Reporters chapter.
JSON and JUnit Reporters
The json and junit reporters write the results to a file that other programs can read.
Set outputFile to choose the file name:
Example
playwright.config.js
reporter: [['json', { outputFile: 'test-results.json' }]],
This is the start of the results in the JSON file, with the first test:
test-results.json
"suites": [
{
"title": "practice.spec.js",
"file": "practice.spec.js",
"column": 0,
"line": 0,
"specs": [
{
"title": "todo page has title",
"ok": true,
"tags": [],
"tests": [
{
"timeout": 30000,
"annotations": [],
"expectedStatus": "passed",
"projectId": "chromium",
"projectName": "chromium",
"results": [
{
"workerIndex": 0,
"parallelIndex": 0,
"status": "passed",
"duration": 447,
"errors": [],
"stdout": [],
"stderr": [],
"retry": 0,
"startTime": "2026-11-18T08:19:13.056Z",
"annotations": [],
"attachments": []
}
],
"status": "expected"
}
],
"id": "a82b13b7c3b1c0abddfd-2779acb9870015838952",
"file": "practice.spec.js",
"line": 4,
"column": 1
The totals at the end of the file:
test-results.json
"stats": {
"startTime": "2026-11-18T08:19:12.237Z",
"duration": 4790.877,
"expected": 4,
"skipped": 0,
"unexpected": 0,
"flaky": 0
}
expected counts passed tests, and unexpected counts failed tests.
JUnit is a test tool for Java.
Its XML file format became a standard for test results.
Most CI servers, like Jenkins, GitLab and Azure DevOps, can read it:
Example
playwright.config.js
reporter: [['junit', { outputFile: 'results.xml' }]],
results.xml
<testsuites id="" name="" tests="4" failures="0" skipped="0" errors="0" time="4.790877">
<testsuite name="practice.spec.js" timestamp="2026-11-18T08:19:12.274Z" hostname="chromium" tests="4" failures="0" skipped="0" time="5.972" errors="0">
<testcase name="todo page has title" classname="practice.spec.js" time="0.447">
</testcase>
<testcase name="can add a todo" classname="practice.spec.js" time="2.133">
</testcase>
<testcase name="student can log in" classname="practice.spec.js" time="3.034">
</testcase>
<testcase name="shop shows all products" classname="practice.spec.js" time="0.358">
</testcase>
</testsuite>
</testsuites>
Several Reporters at Once
Give reporter a list to use several reporters in the same run.
Each reporter is an array with its name and, if needed, its options:
Example
playwright.config.js
// @ts-check
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
fullyParallel: true,
reporter: [
['list'],
['json', { outputFile: 'test-results.json' }],
['junit', { outputFile: 'results.xml' }],
['html', { open: 'never' }],
],
use: {
baseURL: 'https://www.w3schools.com/playwright/practice/',
trace: 'on-first-retry',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
],
});
Output:
Running 4 tests using 4 workers
ok 2 [chromium] › tests/practice.spec.js:24:1 › shop shows all products (358ms)
ok 1 [chromium] › tests/practice.spec.js:4:1 › todo page has title (447ms)
ok 4 [chromium] › tests/practice.spec.js:9:1 › can add a todo (2.1s)
ok 3 [chromium] › tests/practice.spec.js:16:1 › student can log in (3.0s)
4 passed (4.8s)
The terminal shows the list output, and the same run also wrote test-results.json, results.xml and the playwright-report folder.
The JSON and XML examples above come from this run.
The Blob Reporter
The blob reporter saves all results, with screenshots and traces, in a zip file in the blob-report folder.
It is made for sharding: each machine runs one shard and saves a blob report.
Example
npx playwright test --shard=1/2 --reporter=blob
When all shards are done, copy all blob files into one folder, here all-blob-reports.
Then merge them into one HTML report:
Example
npx playwright merge-reports --reporter=html ./all-blob-reports
The CI chapter shows a full example.