Cypress Reporting

A test report summarizes which tests passed, which failed, and how long the entire run took. Reports help teams track testing quality over time without watching every test run live. This topic covers the reporting options available in Cypress.

The Default Console Output

Running Cypress in headless mode prints a summary directly into the terminal.

npx cypress run

The terminal output lists each test file, shows pass and fail counts, and displays the total run duration at the end.

A Simple Way to Picture It

Think of a test report as a scoreboard at the end of a sports match. The scoreboard shows the final score without requiring anyone to watch every play. A Cypress report shows the final testing results without requiring anyone to watch every step.

Built-In Mochawesome Style Reports

Many teams add a reporting plugin such as Mochawesome to generate a detailed HTML report after each run.

npm install mochawesome --save-dev
module.exports = defineConfig({
  reporter: 'mochawesome',
  reporterOptions: {
    reportDir: 'cypress/reports',
    overwrite: false,
    html: true,
    json: true
  }
})

Reporting Flow Diagram

Cypress runs all tests
      |
      v
Reporter plugin collects results
      |
      v
Report file generated (HTML or JSON)
      |
      v
Team reviews the report for failures and trends

Reading an HTML Report

An HTML report typically shows a summary chart at the top, followed by a detailed list of every test with its pass or fail status. Clicking a failed test often reveals the exact error message and a linked screenshot.

Combining Multiple Report Files

Large test suites split across multiple machines produce separate report files that need merging into one combined report. A tool called mochawesome-merge combines these separate files before generating the final HTML output.

npx mochawesome-merge cypress/reports/*.json > cypress/reports/combined.json

Recording Results to a Dashboard

Cypress offers a cloud dashboard service that records test results automatically, showing trends across many runs over time. This service groups tests by branch and commit, helping teams spot flaky tests or recurring failures.

npx cypress run --record --key your-record-key

Why Reporting Matters for Teams

A shared report gives non-technical stakeholders visibility into testing quality without reading raw code. Managers can track pass rates over time to spot quality trends. Developers can quickly find which specific test broke after a recent code change.

Setting Up Automated Report Delivery

Some pipelines automatically upload the generated report as a downloadable file after each run. Others send a summary message to a team chat channel, highlighting pass and fail counts immediately after a run finishes.

Choosing a Reporting Approach

Small teams might rely on simple terminal output for early-stage projects. Growing teams often add an HTML reporter for better visibility into results. Larger organizations with multiple pipelines frequently invest in a dashboard service for long-term trend tracking.

Key Points

  • Cypress prints a basic summary directly into the terminal by default.
  • Reporter plugins like Mochawesome generate detailed HTML reports.
  • Parallel test runs need a merge step to combine multiple report files.
  • A cloud dashboard service tracks test results and trends over time.
  • Good reporting gives both developers and managers visibility into quality.

Leave a Comment

Your email address will not be published. Required fields are marked *