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
Mitch McConnellMitch McConnell 

Apex code coverage and test failures

I am just starting to work on our SF implementation that already contains quite a bit of Apex code,

and I need to add some more.

I was getting errors on my test cases for my trigger, and I noticed that the existing

Opportunity Trigger tests, although they have 100% coverage, 50% of them fail!

Will SF allow code to be pushed as long as it meets the 75% metric, even though

the tests fail?

Thanks,

Mitch

Best Answer chosen by Mitch McConnell
KevinPKevinP
No, the actual bar for deployment is 75% code coverage with *all* passing tests.

The only exception to this is code & tests from managed packages. Basically, if you cannot edit the code, you're not responsivble for testing it. If you *can* edit the code, you're responsible for having passing tests with > 75% code coverage.

All Answers

KevinPKevinP
No, the actual bar for deployment is 75% code coverage with *all* passing tests.

The only exception to this is code & tests from managed packages. Basically, if you cannot edit the code, you're not responsivble for testing it. If you *can* edit the code, you're responsible for having passing tests with > 75% code coverage.
This was selected as the best answer
Mitch McConnellMitch McConnell

Thanks, Kevin.  I should also have explained that these are not my tests.. they are ones that are in the system from the previous developers.  Also, this is in a sandbox already.  Since I can see these tests fail, is there some way that they can be not activated?  

Mitch McConnellMitch McConnell

Also, does it matter if the test class is declared as private?  Mine is public, but the ones I am thinking

may not be activated are private.

KevinPKevinP
The only way to have them be “inactive” that I’m aware of is for them to be part of a managed package. --  Kevin Poorman Sent with Airmail