When deploying Salesforce metadata components (such as Apex classes or triggers), developers may encounter a code coverage error during deployment even though the organization's estimated code coverage appears to be above the required 75% threshold. This discrepancy occurs because the code coverage percentage is recalculated during deployment based on all classes in the org plus the classes being deployed, which can cause the coverage percentage to drop below 75%.
Note: As of Winter '14, the link previously named "Calculate your organization's code coverage" was renamed to "Estimate your organization's code coverage."
Why Estimated Coverage Differs from Deployment Coverage
The "Estimate your organization's code coverage" link in Setup calculates coverage based on the existing classes in your org at that point in time. During deployment, Salesforce recalculates coverage based on the total number of classes in the org PLUS all the classes included in the current deployment package. If the deployed classes do not have corresponding test classes, the total class count increases while covered lines remain the same, causing the coverage percentage to drop.
Example
If your org has 100 classes at 80% coverage and you deploy 50 new classes without test coverage, the new coverage is calculated across 150 classes. The coverage percentage decreases because the 50 new classes are counted in the denominator but are not covered by any test class.
Note: Do not rely on the "Estimate your organization's code coverage" link during deployment. The calculation during deployment is different from the pre-deployment estimate because it includes the new components being deployed. Even a small deployment can impact the test code coverage calculation.
How to Resolve Code Coverage Errors During Deployment
Here are the list of components that trigger "run all tests" during deployment and impact the test code coverage
000385908

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.