< Back

Cypress.io UI Coverage: Ensuring Complete Test Coverage

Author

Koen Van Belle

Date

01/10/2024

Share this article

Testing can often feel like a game of cat and mouse—no matter how thorough you think youʼve been, thereʼs always the chance something important has slipped through the cracks. I learned this lesson firsthand when a button on a rarely used settings page failed in production. Despite what felt like a well-covered test suite, this one crucial interaction had been missed.

Fortunately, Cypress.ioʼs UI Coverage tool offers a way to ensure you donʼt miss those critical UI interactions. This feature highlights gaps in your test suite by generating a list of untested elements across your applicationʼs pages, providing a clear, actionable overview of what still needs coverage.

What Is Cypress.ioʼs UI Coverage Tool?

The UI Coverage tool gives developers detailed insights into which parts of their web applications have been tested—and, just as importantly, which parts have not. After running your tests in Cypress Cloud (with the right license), the tool automatically provides a list of untested elements for each page in your application. This is incredibly useful for identifying gaps in test coverage and ensuring that every button, link, and form field is accounted for.

The best part? No extra configuration is required! Once youʼre running your tests in Cypress Cloud, the UI Coverage tool will generate reports automatically. Although, you might want to introduce some configuration, more on that later on.

How It Works

The UI Coverage tool works by tracking which elements in your web application are interacted with during test execution. After your test suite runs in Cypress Cloud, the tool generates a report listing all the untested elements across the application's pages.

For example, if a "Save" button or a particular dropdown menu on one of your settings pages has not been interacted with in any of the tests, the UI Coverage report will flag these as untested. This gives you a clear indication of where your test suite is falling short, so you can adjust your tests accordingly.

In my own experience, if Iʼd had access to this tool earlier, I would have immediately seen that the “Submit” button on that rarely used settings page hadnʼt been tested, preventing a production bug and saving time.

Key Benefits of the Cypress UI Coverage Tool

1. No Additional Configuration Required

One of the best aspects of the UI Coverage tool is that it requires zero additional setup. You donʼt need to modify your tests or add any new configuration settings. Simply running your tests in Cypress Cloud with the correct license gives you automatic access to UI coverage reports. This makes it incredibly easy to start monitoring your coverage without needing to overhaul your workflow.

2. Comprehensive Coverage Insights

Instead of providing a visual heatmap, Cypressʼs UI Coverage tool gives you a clear list of untested elements on each page. This makes it easy to identify which parts of your application have been overlooked, and helps ensure that all important UI elements have been tested.

The list can include:

  • Buttons that havenʼt been clicked

  • Links that havenʼt been navigated

  • Input fields that havenʼt been interacted with

This detailed breakdown helps you focus your testing efforts where theyʼre needed most.

3. Prevent Critical Bugs

As I mentioned earlier, the UI Coverage tool could have saved me from the oversight of that untested button in my own project. By clearly flagging untested elements, the tool reduces the risk of critical bugs slipping through into production. With full visibility into which UI elements have been missed by tests, you can catch issues before they become costly problems.

4. Perfect for Complex Applications

For applications with numerous pages and many interactive elements, manually tracking test coverage can be daunting. The Cypress UI Coverage tool simplifies this by breaking everything down for you. It lists every page and element that hasnʼt been tested, giving you a straightforward path to full coverage.

This is especially valuable when your app grows in complexity, and the number of interactive elements increases. No more guessing or manually auditing tests—everything you need is right in the coverage report.

5. Easy Reporting for Stakeholders

The reports generated by the Cypress UI Coverage tool arenʼt just useful for developers—theyʼre also valuable for stakeholders and management. By reviewing the list of untested elements, you can provide clear insights into your test coverage and demonstrate where testing efforts are focused.

This transparency is important for showing non-technical team members that all critical parts of the UI are being thoroughly tested, providing greater confidence in the productʼs quality.

6. Higher confidence in testing

Without Cypress Cloud, we were often asked for the coverage of our tests. And each time we have no other choice but to guess a percentage. Now we can confidently give an answer, not based on guesswork, but on real data.

Knowing this will increase confidence in the testing framework a thousand fold, if off course there aren't too many untested elements

Seamless Integration with Cypress Cloud

One of the most impressive aspects of the Cypress UI Coverage tool is its seamless integration with Cypress Cloud. As soon as your tests are run in the cloud, the coverage report is generated automatically— no additional configuration required. You donʼt need to add new libraries, write custom scripts, or change your test files. Everything is handled by Cypress Cloud itself.

This tight integration with your Continuous Integration (CI) pipelines means that your coverage data is always up to date and ready for review after each test run. Whether youʼre working on a new feature or debugging existing ones, the Cypress UI Coverage tool makes it easy to maintain comprehensive test coverage without extra effort.

There is a side note to be made on the whole no additional configuration needed. While it is not needed, I would advice to have some configuration. This is done in Cypress cloud itself and it allows you to exclude certain elements from the check.

For instance at my current project, we are forced to use a header and footer from another company so all those elements are untested. And there were a surpising many of them. In order to report correctly to the coverage of my tests, both the header and the footer had to be excluded from the tests.

Conclusion:

Why the Cypress UI Coverage Tool is Essential for Your Testing Strategy

The Cypress UI Coverage tool offers a straightforward yet powerful solution to a common problem: missed UI elements in testing. By automatically generating a list of untested elements across your application, it ensures that nothing is overlooked, and every critical button, link, and field gets the attention it needs.

For developers like me, whoʼve experienced the consequences of missing a crucial button or interaction in testing, this tool is a must-have. Itʼs simple to use, requires no additional setup, and provides actionable insights that can prevent bugs from reaching production.

Whether your app is large and complex or small and growing, the Cypress UI Coverage tool gives you the confidence that your tests are as comprehensive as possible—without adding extra work to your process.

Links

Cypress | UI Coverage Trial