You need to sign in to do that
Don't have an account?
Gargi Manjee
Code Coverage for same class and test class not consistent in Production and in Sandbox.
Hi All,
I have created a class and test class. The code coverage for the class is showing 91% in sandbox. When I am trying to deploy in production it is showing 67% on validation against specified test and giving 74% for default test.
Can someone provide an insight why this is happening?
I have created a class and test class. The code coverage for the class is showing 91% in sandbox. When I am trying to deploy in production it is showing 67% on validation against specified test and giving 74% for default test.
Can someone provide an insight why this is happening?
I have seen such scenarios in the past. As the code is not posted, I will not be able to identify the root cause exactly, but keep below things in mind:
> Can you check if you and your colleague have the same permissions, profiles, record access?If your test class is using (Seealldata=true), it queries real-time data and so there are high chances that access and available data will make this difference.
>Ensure to clear test history and follow all the steps mentioned in https://help.salesforce.com/articleView?id=000335222&type=1&mode=1 before deployment.
The post-https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_code_coverage_best_pract.htm has a section Why Code Coverage Numbers Differ Between Sandbox and Production which should help in understanding what went wrong.
Related: https://salesforce.stackexchange.com/questions/72037/code-coverage-issues-during-production-deployment-number-of-test-classes-run
https://salesforce.stackexchange.com/questions/76647/code-coverage-of-93-in-sandbox-but-only-61-in-production-wont-deploy
If this information helps, please mark the answer as best. Thank you