Rayrun
← Back to Discord Forum

Test reporter format that allows for just a basic report of number of tests passed/failed/etc?

philipfong.posted in #help-playwright
Open in Discord

I've tried a bunch of different reports, and all of them end up containing color code characters that need to be manually removed with some messy regex/grep/sed type calls. Even the JSON reporter does not report something simple like { "passed": 100, "failed: "0", "flaky": 1 } or anything to that effect.

This thread is trying to answer question "Is there a test reporter format that provides a simple report of the number of tests passed/failed/etc. without including color code characters?"

3 replies

Probably easiest way would be to create your own

Okay thanks

This one has some simple counts in .txt output. https://www.npmjs.com/package/@skilbourn/playwright-report-summary

Answer

Meet the List Reporter in Playwright Test

The List reporter is a built-in reporter in @playwright/test. It's a great choice if you want a concise report of your tests without any color code characters.

What Does It Do?

The List reporter prints a line for each test run and provides detailed information about failures. It's more concise than other reporters and doesn't contain color code characters.

Here's an example of what the output looks like:

1 ✓ should access error in env (438ms)
2 ✓ handle long test names (515ms)
3 x 1) render expected (691ms)
4 ✓ should timeout (932ms)
5 should repeat each:
6 ✓ should respect enclosing .gitignore (569ms)
7 should teardown env after timeout:
8 should respect excluded tests:
9 ✓ should handle env beforeEach error (638ms)
10 should respect enclosing .gitignore:

In this example, you can see that there are 10 tests in total. Out of these, 8 have passed successfully and 1 has failed (render expected). The remaining test (should repeat each) does not have a specific pass/fail status mentioned.

How to Use It

To use the List reporter, specify it as your desired reporter format in your Playwright configuration file (playwright.config.ts). Here's how you can do that:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: 'list',
});

By setting reporter to 'list', you enable the List reporter format for your test runs. This will give you a basic report of the number of tests passed, failed, etc. without any color code characters.

So, if you're looking for a straightforward and concise test report, give the List reporter a try!

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.