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
RadnipRadnip 

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?

 

GunishGunish
Hey,

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.

-Gunish
Ashish_SFDCAshish_SFDC

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. 

 

https://success.salesforce.com/issues_view?id=a1p30000000T0kUAAS

 

Summary
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.

Repro
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.

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

 

Regards,

Ashish

 

RadnipRadnip

@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.

GunishGunish
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.


http://salesforce.stackexchange.com/questions/11462/apex-class-code-coverage-stuck-at-0-no-coverage-data-after-running-test-class
Ashish_SFDCAshish_SFDC

Hi ,

 

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

 

Regards,

Ashish

 

 

 

RadnipRadnip

I've actually just read the post :)

 

Thanks