How Apex Code Coverage Works

An often misunderstood aspect of Salesforce development is how the code coverage numbers are calculated. Here's a throwback article the Salesforce Developer blog that explains the calculation in detail and how it can be different than the result you get when deploying.
https://developer.salesforce.com/blogs/developer-relations/2012/11/how-code-coverage-works

Note to self: If you want to make sure you're getting a more pure result of code coverage (especially the lines covered) from the specific tests you're running right now, make sure to enable "Store Only Aggregated Code Coverage" (Setup -> Apex Test Execution -> Options)
This resets the test results data every time a new test run is executed.


You'll only receive email when they publish something new.

More from Scott McClung
All posts