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
TerminusbotTerminusbot 

Sandbox to Production Deploy Issue: Code Coverage Over 95% and Fails

I am trying to deploy my Apex Classes and Trigger to Production. I have confirmed these code coverages in Mavensmate and Developer Console.

Class Code Coverage

Trigger Coverage

When I deploy. I get this error. I also see this error when I try and deploy from Eclipse.

Deploy Results

I am starting to scramlbe here since I need these in Production by Monday. Thanks for any help you may be able to provide.
 
@Karanraj@Karanraj
We can't expect same code coverage of the class in the production instances unless you have written the class as per the best practice. I would first suggest to validate and check the code coverage in production instances and also if you could share the test class for trigger it might help us to guide you in the better way.
Agustina GarciaAgustina Garcia
Agree with @Karanraj

My suggestion is to go to your organization:
  1. Setup | App Setup | Develop | Test Execution
  2. Click On View Test History link and Clear Test Data to be sure that there is no other execution that could affect to your results.
  3. Go again to Setup | App Setup | Develop and click on Select Test There you would find a list of all test there are in your organization. Maybe you have missed any on MM
  4. Click Run
  5. Once all finishes, click on Developer Console button that opens the Developer Console and shows you the total coverage of all tests. Also if you click on the class, you can see lines are not covered. In any case, coverage on developer instances could be a bit less than in productions, so take it into account.
Let us know if these steps still shows you a high coverage and you cannot deploy

Agustina