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
persistent 129persistent 129 

Not able to deploy classes into production due to code coverage error, but code coverage of Production is 78%.

We are not able to deploy classes into Production because of code coverage. But the code coverage of Production is 78% right now, we have also complied the classes and cleared all histrory related to Running test classes. What whould be the issue ?
KaranrajKaranraj
What is the percentage its displaying in the error message screen? While deploying the compoenents the code coverage calculation will be done including your new components also. If it is less than 75% then you might have to increase code coverage for all the class, make sure to keep atleast above 90% for all class in your org.
persistent 129persistent 129

@karanraj

It is showing 74% only and I am deploying just one compoment with its test class having 90% code coverage. I think there is an issue related to this topics becuase i heard this 2 3 times in last few days from other people.

KaranrajKaranraj
Over all code coverage is calculated based on the average code coverage of all class in your org.
For Example if you are having already 3 class with the following percentage as 90%,45%,90% then average code coverage of your org is 75% now if you are deploying new components with 75% your over all code coverage might get affected with the new average.

Make sure that you are creating test data in our test class, else your percentage won't show properly in sandox and in production.

Thanks,
Karanraj
http://www.karanrajs.com
PuneetsfdcPuneetsfdc
Is there any trigger written which you are deploying with your class, if yes then make sure you have code coverage for your trigger as well. Atleast 1% coverage required for trigger.