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
kieran.osullivankieran.osullivan 

Discrepancy between Code Coverage in Sandbox and Production

Discrepancy between Code Coverage in Sandbox and Production

 

In brief my question is When I am told that the deployment has failed because there is only 73% code coverage how do I find which code is not covered.  Do not say look at the classes because they do not show this info.  The attempt to deploy may run all the tests but I can't find where it puts the results/

 

When I disable a trigger and deploy it, it fails in production because some test is less than 75%.

 

However the trigger uses only one class and that class has its own test data and method.

When I run the tests in the sandbox they give code coverage of 80% for this class.

When the trigger is enabled it deploys every time.

I need to turn this trigger off as it is used to generate code numbers and they are not needed when the data is being imported.

 

s_k_as_k_a

when deploying code into production, the code coverage of all tests in your organisation(your overall organisation code coverage) will consider even though you are deploying one class that cover more than 75%.. when your overall organisation code more or equal to 75% you can deploy.

 

To check overall code coverage  go to 

  

APP Setup  ---------> Develop-----------------> apexclasses then click on the button "Run All Tests" then you can see overall code coverage after all tests running done.  Once all tests completed to run if you navigate to the apex classes page there in codecoverage column you can see the code coverage of each classes. If you click on code coverage corresponding to class you can see which lines are covered in that class and not.

sushant sussushant sus
APP Setup ---------> Develop-----------------> apexclasses then click on the button "Run All Tests

you can check code coverage