The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Did you know that you can generate really nice diagrams of your test coverage? How? Well, write some Apex and some tests.

In the online builder environment, navigate to Setup | Develop | Apex Classes. Then select your class and hit Run Tests. You’ll see something like this:

t1.jpg

What isn’t too obvious, is that you can click on those numbers. If you do, you’ll see a little popup like this one:

t2.jpg

The blue bits are the code that has coverage. Red lines don’t have coverage. And the numbers along the side indicate how many times the lines were executed when exercised by the tests.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS