Apex test coverage: what 95% real coverage actually looks like
Salesforce requires 75% Apex code coverage for production deployment. This means most orgs have tests that exist primarily to pass that gate. Coverage is reported as a single number. The number lies. We have audited dozens of Salesforce orgs in the last three years; the gap between nominal coverage and real coverage is reliably 15-25 percentage points.
Nominal coverage counts lines executed. Real coverage requires meaningful assertions. A test that calls a method and then asserts the result is not null is nominal coverage. A test that calls a method with five distinct inputs and asserts the specific business outcome for each is real coverage. The difference shows up when production behavior breaks and the tests pass anyway.
We use three checks to distinguish: (1) assertion density — at least one assertion per public method tested, ideally per branch; (2) negative-case coverage — every test class has at least one test verifying that invalid input is rejected; (3) data-isolation discipline — no @testSetup methods that quietly leak state, no Test.startTest() blocks that span multiple business operations.
Real 95% coverage on Salesforce is not unreachable; it is unfashionable. The path is: pyright-level test discipline, refusal to ship lines without meaningful assertions, and willingness to refactor untestable code so it can be tested. We have rebuilt test suites from 76% nominal to 92% real on multiple engagements; the regression rate drops 60-80% as a result.