function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bs881026bs881026 

Code coverage for classes is 100%

Hi,
I the code coverage for the classes that I am about to deploy is 100% but the overall code coverage has dropped to 70%, what is the workaround for it.
Thanks.
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Bs881026,
  • Please note that if the apex code and the test class have 100% code coverage and you are still unable to deploy it in production due to low code coverage.
  • It means that the overall code coverage of other existing components (trigger and classes) in production is below 75% and the deployment will not be successful.
  • To avoid this:
  • Ensure that all classes/ triggers have above 75% code coverage.
  • All classes should be valid. (Recompiled)
If the production coverage is going down because of the test classes, which is coming in Dev console
Please follow the Tooling API for that: Why is a Test class evaluated as part of the Organization’s Code Coverage? I hope it will be helpful.

Please mark it as best answer if the information is informative.

BestRegards
RahulKumar