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
CaitlinGMCaitlinGM 

Trigger deployment--average coverage below 75%, best method to use

Sorry if this is a really basic question, but: I have a trigger, I wrote a test for it, and it is displaying 100% coverage in my Sandbox. I want to deploy it to production, but my overall average coverage is only 72%. I can't deploy unless everything is at 75%, right? The problem is, the code without sufficient coverage is part of managed packages--installed apps. Is it really the case that I have to fix or get rid of other people's mistakes in order to be able to deploy my trigger?

 

I also just downloaded Eclipse with the Force.com IDE. Is that a better way to go to deploy my trigger?

 

Thanks for the help.  

Best Answer chosen by Admin (Salesforce Developers) 
Kevin BromerKevin Bromer

The deployment runs the tests for the code being deployed, so as long as that's above 75%, you should be okay to deploy.  Just make sure your test class is going out with your trigger 

 

 

All Answers

Kevin BromerKevin Bromer

Hi Caitlin-

 

Are you deploying your test class with the trigger when you deploy? 

 

If you're comfortable in a programming environment/IDE, Eclipse has some advantages, but it really depends on what you mean by 'better'.  Both methods work equally as well, the IDE probably provides a bit more information and flexibility in your deployments, but is certainly more complex.

 

 

CaitlinGMCaitlinGM

Thanks. I guess my question is whether it is possible to deploy this code considering total average coverage for all code is below 75%. 

Kevin BromerKevin Bromer

The deployment runs the tests for the code being deployed, so as long as that's above 75%, you should be okay to deploy.  Just make sure your test class is going out with your trigger 

 

 

This was selected as the best answer
CaitlinGMCaitlinGM

OK, I knew it was a silly question. Thanks :)

Kevin BromerKevin Bromer

I'm sorry, Caitlan, I was trying to do too many things at once, please ignore my earlier comment, I wasn't reading your question correctly. 

 

If you're not getting enough coverage on the deploy, you won't be able to deploy, but you would be able to pass the tests locally if you only are running the test class for your trigger..  

 

However, the culprit probably isn't your managed package, because it needed at least 75% coverage to be installed in the first place. So something may be interfering with its tests in your code base, things like validation rules, new triggers, etc.

 

Here's a great thread on the boards explaining it: http://boards.developerforce.com/t5/Apex-Code-Development/My-code-coverage-fails-because-of-3rd-party-managed-packages/td-p/235583

 

Sorry to confuse things!