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
Mhlangano Khumalo 7Mhlangano Khumalo 7 

Unable to deploy to production. Overall code coverage 32% in production & 77% in the sandbox. Help!

Our company org was a Trial org for 3 months. Throughout that time, a lot of code was done in production as a Trial org doesn't have a Sandbox. Most of the code was developed without test classes. The trial expired, we got a Sandbox & now we can't deploy to production because of low overall test coverage. I wrote test classes in the sandbox and managed to increase coverage to 77%. The problem now is when I deploy them, I get an error about low coverage in production. How can I work around this, as I can't create/edit classes in production.

User-added image
I increased code coverage in the sandbox from 31%  to 77% but I still get the low coverage error. Below is Production screenshot.

User-added image

What can I do to work around this issue?

 
Sunil MadanaSunil Madana
Hello, please try the below and hope it works as I had the same issue before.
  1. Do you have still access to the production environment(TRIAL ORG) to request for a security token?
    • If yes, then request for a security token and download all the apex classes to your Force.com IDE (Eclipse - Local Copy). You may also delete the classes (which does not have test class) in production directly and later deploy them using change sets from your sandbox (Existing Apex code + New Test class that you wrote).
Appreciate your feedback so that community members will know. Thanks.
JeffreyStevensJeffreyStevens
Are you getting any ERRORS when deploying to production?  Maybe you've put some validation rules in palce in production that's not in your sandbox, and therefore - some of your test data isn't being created?