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
shobana shobana 1shobana shobana 1 

Deployment fails even code coverage is 96%

Hi i am trying to deploy the apex class,controller and test class from one sandbox environment to another. I have 96% code coverage whil edeploying it showing 64% in destination sanbox environment. I didn't use seealldata also.
can anyone help to solve this.
VineetKumarVineetKumar
Your destination organisation must have atleast 75% of code coverage for the new code to be deployed on it.
Instead of running all test class while deploying, you can run a specific test class associated to your test class (provided the coverage is above 75%)

Let me know if this helps.
shobana shobana 1shobana shobana 1
Hi Vineetkumar

I used run a specific test class only
 
VineetKumarVineetKumar
Then mayye 64% is your code's actual code coverage.
Check the coverage by running the test using apex run test not the developer console.
shobana shobana 1shobana shobana 1
Hi Vineetkumar

i have run the test call in Apex Test Execution and i check the code coverage it showing 96% only
 
VineetKumarVineetKumar
hmm.. the only possibility that I can see is that you test class is failing while you are trying to deploy on the new org. 
Perhaps some validation or some existing class is causing your new class to fail.