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
Tobias Toal - activeTobias Toal - active 

Deploy even though code coverage is less than 75%

Hi all,

a few weeks back, we deployed a change set, even though our code coverage in our production org was at 66% (we ran all tests and checked).
We couldn't deploy via MavensMate (got the error that code coverage is too low), but it worked fine via frontend with change sets.
Any idea, what the reason could be??

Thanks and best regards
Toby
Best Answer chosen by Tobias Toal - active
ericmonteericmonte
There's a couple reason for this, Mavens Mate evaluates current environment and checks to make sure all apex classes is up to 75%. As William mentioned above, there maybe classes that are throwing off the test classes.

When you move through changes sets, it moves selected metadata and classes into the environment. Then it  test the new changeset and existing classes to see if it's 75% or more. If the validation is under 75% with the new code then it will roll back the changes.

Hope this make sense.

All Answers

William TranWilliam Tran
If it deploys before, it could be an error or eventhough one module is at 66%, the overall coverage for all files was actually above the threshold.

Regardless, the best option is to write test classes to increase the coverage vs trying to figure out why it worked before eventhough it shouldn't have.

Thx
ericmonteericmonte
There's a couple reason for this, Mavens Mate evaluates current environment and checks to make sure all apex classes is up to 75%. As William mentioned above, there maybe classes that are throwing off the test classes.

When you move through changes sets, it moves selected metadata and classes into the environment. Then it  test the new changeset and existing classes to see if it's 75% or more. If the validation is under 75% with the new code then it will roll back the changes.

Hope this make sense.
This was selected as the best answer
Tobias Toal - activeTobias Toal - active

Thanks guys,

it was definitely the overall coverage in production, that was at 66%. That's what I don't understand.
We added test classes in the meantime and increased the overall coverage to 87%, so normally I wouldn't even think about it anymore. It's just that my customer is expecting an answer, how this was possible.

Cheers
Toby

Tobias Toal - activeTobias Toal - active
Well, I haven't found an explanation but the customer stopped asking so we stopped thinking about it.
Just don't go under 75% is probably the best solution for this.
Question solved.