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
Aidel BruckAidel Bruck 

Deploying trigger to production problems

Hi, 
I am a begginger with triggers. And I just created my first trigger. I created a test class and my trigger has 95% code coverage. 
I am trying to use change sets to deploy it to production. 
when I validate it in production I get the following error
Your code coverage is 58%. You need at least 75% coverage to complete this deployment.
This seems to because there are errors with other test classes previously uploaded by previous developers. 
I don't know how to proceed. 
Is there any way to deploy this without running every single old class in production? It seems a bit funny that a perfectly good trigger with a great test can be deployed because of some old classes that I don't know how to change. 
Thanks in advance, 
Aidel
Davide MolinariDavide Molinari
Hi Aidel,
Did you add to the change set only the trigger and its test class?
The change set you deploy in prod must have an overall code coverage of 75%.

Davide
Aidel BruckAidel Bruck
the only thing in the change set is the trigger and the test class that have an 95% code coverage. 
The errors I am getting when I deploy the change set are due to unrelated classes. It seems like there is some sort of overall company code coverage check happening. 
Davide MolinariDavide Molinari
Yes, it is exactly what it happens: when you deploy something, all test classes are executed.
I wonder why there is a code coverage of 58% in production. I think you should write some test classes in a Sandbox environment, to reach the 75% of code coverage, and then deploy all test classes in production.
Aidel BruckAidel Bruck
is there any way to remove classes from production?
 
Davide MolinariDavide Molinari
You can follow these steps: https://developer.salesforce.com/forums/?id=906F00000008yIyIAI