You need to sign in to do that
Don't have an account?
Itzik Winograd
Code Coverage drops when deployed
Hi all!
I'm trying to deploy a class and it's test class from sandbox.
Class B17 stands on 75% coverage, and tests runs perfectly in console. Class B17Test is the test class. I made an outbound change set that holds BOTH classes.
When deploying in production, i choose Run specified tests and mentioning only B17Test class. It fails over "Code Coverage Error" - only 5% is covered.
How can it be if i have 75% in sandbox? And what should i do to successfully deploy the classes?
It IS my firs Class deployment, so any help would be MUCH appreciated! :)
I'm trying to deploy a class and it's test class from sandbox.
Class B17 stands on 75% coverage, and tests runs perfectly in console. Class B17Test is the test class. I made an outbound change set that holds BOTH classes.
When deploying in production, i choose Run specified tests and mentioning only B17Test class. It fails over "Code Coverage Error" - only 5% is covered.
How can it be if i have 75% in sandbox? And what should i do to successfully deploy the classes?
It IS my firs Class deployment, so any help would be MUCH appreciated! :)
Did you use the @isTest(SeeAllData=true) annotation?, the test results can differ depending on which data is available in the organization. If the records referenced in a test don’t exist or have changed, the test fails or different code paths are executed in the Apex methods; so, the code coverage can decrease a lot. If you put this annotation (SeeAllData=true), please, try to remove it and make another deployment.
Did you install some App Exchange Managed Package or did you make changes at some profile's settings?
Regads,
All Answers
https://developer.salesforce.com/forums/?id=906F0000000B27eIAC
They cover there the same issue.
I have encountered this thread before. It seems that a specific change happened during this thread's liftime.
Both classes were deployed few month ago with 75% succesfully, and nothing was changed at the B17 class body but a replacment of a formula field with regular number field - with equivalent tests added to maitain 75% covarege.
Any suggestions?
Did you use the @isTest(SeeAllData=true) annotation?, the test results can differ depending on which data is available in the organization. If the records referenced in a test don’t exist or have changed, the test fails or different code paths are executed in the Apex methods; so, the code coverage can decrease a lot. If you put this annotation (SeeAllData=true), please, try to remove it and make another deployment.
Did you install some App Exchange Managed Package or did you make changes at some profile's settings?
Regads,
I don't get any specific errors (e.g. validation or PB errors), but I understand from your answer that this intense decrease is probably due to difference between environment..
We'll probably go to full sandbox refresh for this.
THANKS again!
Best regads,
Jose Fluxa