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
Syed Abid ShahSyed Abid Shah 

I am facing challenges with code coverage

Hi Folks,

Recently we developed a functionality in staging instance to delete multiple cases at a time however business approved to move this to Production. when we tried to deploye same from UAT instance to Prodcution its throwing error 'code coverage is not 75%'. can you please let us know how best we can build up to cover 75% coverage to make smotth deployment.
Details below:
We got deployment Error during Deploying “Delete Cases ” custom button in production .
Organization’s code coverage is 54% and few triggers have 0% code coverage in production. We need minimum  75%  organization code coverage to deploy the code into production.


Thanks
Syed
 
Raj VakatiRaj Vakati
Hi Syed  ,

Please use this links 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_best_practices.htm
https://developer.salesforce.com/page/How_to_Write_Good_Unit_Tests


 
karthikeyan perumalkarthikeyan perumal
Hello, 

Run you all test class in production  once. using below option. 

Setup->Apex class-consider below image: 
click on " Run All Tests" its referesh your code coverage. 

User-added image

Trigger: 

in your deployment package if there is any trigger- trigger must have atleast 1% of code coverage. 
so you have to write test class for your triggers also. 

Class: 

check all test class must have above 75% code coverage. so that your org coverage will increase. if your class doest not have above 75 % your org also will fail to get 75% and above. 

hope this wil help you.

if everything is clear above issue will gone automatically.


Thanks
karthik