Reporters

Reporter modules format and output TestCafe test run results.

Included Reporters

TestCafe includes the following reporters out of the box:

Community Reporters and Custom Reporters

You can install community reporters or create a custom reporter of your own.

The following community reporters are amongst the most popular:

Install New Reporters

Reporter plugins are npm packages. TestCafe reporter package names start with the testcafe-reporter- prefix (for example, testcafe-reporter-list).

You can search for reporter packages on npm: https://www.npmjs.com/search?q=testcafe-reporter.

Install reporter packages from npm as you would install any other plugin. See Install Plugins.

Specify the Reporter

The default reporter is spec. To use an alternative reporter, use the -r (--reporter) CLI option or the [runner.reporter] Test Runner method.

testcafe all ./tests/sample-fixture.js -r xunit
await runner
    .browsers('all')
    .src('./tests/sample-fixture.js')
    .reporter('xunit')
    .run();

You can also specify which the reporter in the configuration file.

Output data to disk

TestCafe reporters can write report data to disk:

testcafe all ./tests/sample-fixture.js -r json:report.json
await runner
    .browsers('all')
    .src('./tests/sample-fixture.js')
    .reporter('json', 'report.json')
    .run();

Use Multiple Reporters

You can use multiple reporters, provided only one of them writes to stdout. In the examples below, the spec reporter outputs data to stdout, while the xunit reporter writes data to disk.

testcafe all ./tests/sample-fixture.js -r spec,xunit:report.xml
await runner
    .browsers('all')
    .src('./tests/sample-fixture.js')
    .reporter(['spec', {
        name: 'xunit',
        output: 'report.xml'
    })
    .run();