You need to sign in to do that
Don't have an account?
Jorgan Strathman
Production Code Coverage: 0%
"Your overall code coverage is currently 0%"
HUH? I was very unpleasantly surprised to find out, when I went to deploy my first custom class from SB to PROD, that my PROD is returning 0% code coverage (without my class!). This isn't possible... is it?
I am using out-of-the-box Salesforce with only one managed package: The Foundation's Nonprofit Start Pack v3. No custom code, repeat no code, no validations... the org is new. I have run all tests and I physcially see the majority of the managed TCs pass but it makes no difference at all. I just keep staring at 0% org wide coverage. I opened a CASE with SFDC Support and they turned me away. I went out to the forums and tried everything... Developer Console, Workbench... I have cleared the ApexCodeCoverage table and the ApexCodeCoverageAggregate table. I have compiled and recompiled... no difference. My zombie org sits at 0% code coverage and despite having only ONE custom class and TC in SB at 92% coverage... my hands are tied. I can't deploy anything.
PLEASE HELP.
HUH? I was very unpleasantly surprised to find out, when I went to deploy my first custom class from SB to PROD, that my PROD is returning 0% code coverage (without my class!). This isn't possible... is it?
I am using out-of-the-box Salesforce with only one managed package: The Foundation's Nonprofit Start Pack v3. No custom code, repeat no code, no validations... the org is new. I have run all tests and I physcially see the majority of the managed TCs pass but it makes no difference at all. I just keep staring at 0% org wide coverage. I opened a CASE with SFDC Support and they turned me away. I went out to the forums and tried everything... Developer Console, Workbench... I have cleared the ApexCodeCoverage table and the ApexCodeCoverageAggregate table. I have compiled and recompiled... no difference. My zombie org sits at 0% code coverage and despite having only ONE custom class and TC in SB at 92% coverage... my hands are tied. I can't deploy anything.
PLEASE HELP.
After considering all other non-managed functions in the system operating on the primary objects in the code (Lead, Account, Contact and Opportunity). I tried to run down all validation rules, workflows, process builders and any other custom code (non-managed on those items - there was none). It dawned on me that Standard Duplicate Management Rules might also be running and could adversely affect my custom Test Class by blocking creation of test data (which essentially it was). I deactivated the duplicate management rule, re-compiled the classes, cleared the test history, ran all tests. I then re-validated the inbound changeset which passed at 91%. I cleared the history, re-compiled and re-ran tests. I then re-estimated and came up with 91% code coverage (post deployment). I then flipped the Duplicate Management Rule back on, cleared the test history, recompiled the classes and ran all tests. Code coverage came up as 1%.
It appears that when the currently active Account duplicate rule is turned on / active the org code coverage is calculated as 1%. However, when the currently active Account duplicate rule is turned off / deactivated the org code coverage is calculated as 91%.
FOR ANYONE OUT THERE HEAD SCRATCHING like I was, don't forget Duplicate Management Rules! (It cost me about 24 hours of my life!)
All Answers
However, I can deploy (although I'm not hitting the 75% for another reason). It might be a bug.
Try and make a outgoing changeset that includes your class and your test class (and any related neccessary objects etc) and see if it validates
Make sure that you are including the Apex Class / Apex Trigger which you have written for your functionality into outbound Changeset along with your Test Classes then it will run all the test classes while deploying into Production.
First try to deploy any configuration component like a custom field / custom object / validation rule / work flow. By doing these we will know that there is no issue with the current Production environment.
Regards,
Mahesh
After considering all other non-managed functions in the system operating on the primary objects in the code (Lead, Account, Contact and Opportunity). I tried to run down all validation rules, workflows, process builders and any other custom code (non-managed on those items - there was none). It dawned on me that Standard Duplicate Management Rules might also be running and could adversely affect my custom Test Class by blocking creation of test data (which essentially it was). I deactivated the duplicate management rule, re-compiled the classes, cleared the test history, ran all tests. I then re-validated the inbound changeset which passed at 91%. I cleared the history, re-compiled and re-ran tests. I then re-estimated and came up with 91% code coverage (post deployment). I then flipped the Duplicate Management Rule back on, cleared the test history, recompiled the classes and ran all tests. Code coverage came up as 1%.
It appears that when the currently active Account duplicate rule is turned on / active the org code coverage is calculated as 1%. However, when the currently active Account duplicate rule is turned off / deactivated the org code coverage is calculated as 91%.
FOR ANYONE OUT THERE HEAD SCRATCHING like I was, don't forget Duplicate Management Rules! (It cost me about 24 hours of my life!)
@Jorgan,
I am facing the same issue experienced by you.
No Custom Code in Prod (NPSP installed)- Code Coverage 0 % while running all classes even I have deactivated all Duplicate & Matching Rules in org.
While deploying inbound ChangeSet- Failed low code coverage 62%, I have only 100 lines of codes moving from SB to Prod so I am not sure what is happening.
Please help.
Thanks,
Bhisham
Please open a separate discussion and paste your class and test class so that it will be easy to help you.
Regards,
Mahesh
With the Duplicate & Matching Rules enabled, were your test classes failing? Or were they passing and you just got the 0% code coverage at the end?
I'd expect that if Salesforce was blocking the addition of a duplicate record, it would generate an error and the test class would fail. Is that not what you were seeing?
-L