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
PronowPronow 

How to bypass runAll test while deploying to Production?

Hello there,

I have a weired problem while deploying change sets to production. I am trying to deploy an updated trigger, and it gives warning that Trigger and Class Code Coverage is 0% and it should be 75% atleast. Now, previously, I deployed many classes(only classes), it didn't throw such an error.

I need proper understanding of difference between deploying Triggers and classes. Does same procidure applies for same or it differs.  

Thanks in advance.
Best Answer chosen by Pronow
bob_buzzardbob_buzzard
It will still run all tests as that is considered to be a deployment.  It may be that your trigger changes mean that less of the code is being executed.  If you are right on the cusp of 75% coverage, then it won't take much to stop deployments.

All Answers

bob_buzzardbob_buzzard
You can't bypass tests when deploying to production I'm afraid.  All of the tests in your namespace (i.e. not managed packages) will run when you deploy code or triggers.

Usually this type of issue means that something has changed config-wise that means the unit tests aren't covering as much code.  For example, if you have failing unit tests it can be because new required fields or validation rules have been introduced that stop creation of test objects.  Or it can be because your tests are not isolated from production data and the volumes are causing an issue. Or it could be many other things :)

Unfortunately, the bottom line is that you will have to fix up the unit tests as part of the deployment.
PronowPronow
Thank you Bob!

However, I am still amazed that why my deployments succeeded when I deployed classes only and failed when I tried deploying triggers, the first thing. The second thing is that, can I export production code into eclipse/force.com ide and try editing and saving it directly? Will it work? Will it still execute runAllTests?
bob_buzzardbob_buzzard
It will still run all tests as that is considered to be a deployment.  It may be that your trigger changes mean that less of the code is being executed.  If you are right on the cusp of 75% coverage, then it won't take much to stop deployments.
This was selected as the best answer
PronowPronow
Thanks very much Bob!