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
Erica Harris 15Erica Harris 15 

Code coverage figures lost from all but last test method in class - BUG!

I have experienced what has to be a bug in code coverage storage in salesforce.  I had 95% coverage of a class but when checking it, realised I could get complete coverage by adding another test method, which I did.  Now salesforce will only report the coverage from the last method run, although it states that all 5 methods have been passed!  What do I do now? I won't be able to deploy my code, which has to be deployed today to production.  It is reporting 59% because that it what the additional method (the only one it is now counting) covers.
When I look in the developer console at the test results, clicking on each method aside from the newest one shows blank in the code coverage pane.  I'm trying to run the tests again from the IDE instead of the Developer Console, but it is hanging as Not Responding.  The sandbox is a full sandbox on cs12. Has anyone else encountered this?
EMHDevEMHDev
Same person, different login. Code deployed ok, just a bug in sandbox code coverage reporting.
Whew.
Cyrus TalladenCyrus Talladen
When something like this happens the developer console is your friend.  After running tests and including debug statements where you think the test method should have ran check out the debug statements in the debug logs.  Sometimes there are exceptions that may not have been caught by the compiler but is preventing your test methods to execute.  Sometimes adding debug statements in both the class and the test class helps as well to trace the execution of your code.


Cyrus Talladen
CRM Engineer
www.levementum.com
 
EMHDevEMHDev
Hi Cyrus.  
The test methods all executed, passed and worked correctly.  It is a bug in the reporting of the code coverage. In the developer console, the pane was completely blank - not 5%, not anything. The debug logs were exactly as expected.  Code has deployed fine - it is only an issue in the sandbox.
Erica
Cyrus TalladenCyrus Talladen

I have encountered the same exact bug when using Mavensmate. At that time what helped me was to restart, update mm, or reset the metadata.

Cyrus Talladen
CRM Engineer
www.levementum.com