+ Start a Discussion

Code coverage % showing zero when in two different code versions.


Just had a call from a client and think we've found found an interesting bug and wondered if anyone else has had the same issue before and if I'm on the right track...


Sometimes code coverage on classes would show Zero when actually they have tests against them after a lot of fiddling the issue seems to be because the test class and the code class were assigned to different versions after matching up the versions the code coverage %age then appears.


Anyone else have had the same issue?



Yes, I have also started to see this recently. Sounds like there is a change salesforce made to code coverage.

To fix our problem, we simply create a new eclipse project, ran the upgrade wizard to update all the class version. [or you know, manually edited the metadata.xml secretly ;-)] and ran all tests again.

But I can confirm that this has started to happen across board.


Hi Dataville, 


This issue is observed across and also catagorised in our Known Issues, 


Add yourself to the "This issue effects me" by clicking on the button on the below link, also track the progress on the link. The workaround is matching the versions or the one stated below. 




With the Winter '14 release, certain code scenarios are producing 0% code coverage for certain classes. The corresponding rows for effected classes in the ApexCodeCoverage table are not present. 

If you are effected by this issue, please review the scenarios listed below to confirm that symptoms and behaviors are correct. If your symptoms and behaviors are different, please log a case with Salesforce support with a detailed description of your issue.

Scenario 1: A test method that invokes a batch Apex class. The test and batch methods execute successfully. The class has zero % code coverage in the Apex class detail page and the Overall Code Coverage panel in the Developer console.

Scenario 1 Work Around: Edit and Save the test class or Compile all classes from the Apex class list page.






@Ashish_SFDC We tried that workaround on the known issue but it didn't seem to make any difference only when the versions were matched up did it calculate the correct score.

I just went back into my orgs and saw that this is happening again even after the version is being matched as well.

I saw this post on stack exchange and we are going to try it now.


Hi ,


This issue has been fixed, https://success.salesforce.com/issues_view?id=a1p30000000T0kUAAS 








I've actually just read the post :)