Test Case Coverage
In Salesforce Apex development, a metric that shows which Apex classes and triggers are covered by unit tests and which lines of code are exercised during test execution, with a 75% minimum org-wide coverage required for deployment.
Definition
In Salesforce Apex development, a metric that shows which Apex classes and triggers are covered by unit tests and which lines of code are exercised during test execution, with a 75% minimum org-wide coverage required for deployment.
In plain English
“Test Case Coverage (or code coverage) in Salesforce Apex measures which lines of code are exercised during test execution. Salesforce requires a minimum of 75% code coverage for production deployment. It's how you prove your code is tested.”
Worked example
A developer at Drumlin Cosmetics writes a new Apex class for promo-code validation and runs the test suite to check Test Case Coverage. The Salesforce platform reports 82% coverage on the new class - above the 75% minimum required for production deployment. The Coverage report shows three lines uncovered (an unused error path); she adds an additional test method targeting that branch and re-runs, hitting 96%. Production deploy requires 75% org-wide coverage across all custom Apex; without sufficient Test Case Coverage, deploys are blocked. The 75% bar is a quality gate, not a target - most teams aim higher.
Why Test Case Coverage matters
In Salesforce Apex development, Test Case Coverage is a metric that shows which Apex classes and triggers are covered by unit tests and which lines of code are exercised during test execution, with a 75% minimum coverage requirement for production deployment. Coverage is calculated as the percentage of lines executed by tests divided by total executable lines.
The 75% minimum is a platform requirement, not a quality target. Mature teams aim for much higher coverage (85-95%) and focus on meaningful tests that validate behavior rather than just touching lines. Code that merely executes without assertions doesn't provide real testing value even though it counts toward coverage.
How organizations use Test Case Coverage
Targets 90%+ code coverage with meaningful assertions, not just line coverage.
Trains developers on writing meaningful tests that validate behavior, not just hit coverage.
Treats 75% as the floor, with team standards requiring much higher coverage.
Test your knowledge
Q1. What is Test Case Coverage?
Q2. What's the minimum for deployment?
Q3. Is 75% a good target?
Discussion
Loading discussion…