+ Start a Discussion
B&D DeveloperB&D Developer 

Getting Stuck at 74% Code Coverage upon Validation

I am trying to deploy my codes from Sandbox to Production and no matter what Class I include in my Change Set the Validation stuck at 74%.
I ran an overall Test in my Production and it's 81% my Sandbox also Shows 86%.

I also ran individual test on all the class that I am trying to deploy and none of them getting below 84%.

Please Help...
What shoudl I do and What would be the best practices in deploying Apex to Production
KevinPKevinP
so the key to understanding this is knowing when and how validation tests are run.

When you deploy a changeset, and run validation it puts your new code, *and tests* in place, and *then* runs your tests. This is the coverage that counts. if your new code invalidated or causes some tests to fail, your test coverage will fall. 

without knowing exactly what code you're deploying it will be hard to figure this one out but what I can guarantee you, having been in this situation, is that the net coverage of your org during a changeset validation is calculated with your production org + to-deploy code.
 
ra811.3921220580267847E12ra811.3921220580267847E12
HI,

While deploying the code, you validated ChangeSet? if, it's show any test failures?