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
Mason StaerkelMason Staerkel 

Inaccurate Code Coverage in Salesforce (Browser)

When I am trying to review my code coverage in Salesforce (browser) I am getting wildly incorrect coverage results. For example, I have a class "AccountTeamHelper" and in the browser it is saying (on the Apex class page, and in the developer console) 54% coverage. If I run the test in the IDE (eclipse) I am getting a result of 98%. To see which one was giving me the incorrect information I went into the class code coverage view in the Developer Console and half of the lines didn't even match up (Red lines on comments, etc.) and it said some constructors were not being covered, but I can clearly see in my first test on that all of the constructor methods are being tested. It is kind of annoying that I have to test my code outside of the system on a slower process because I can't trust the results being returned to me in the browser. I have also tried clearing all test data, re-compiling all classes, and then running all tests. This has not changed my inaccurate code coverage results.
I had similar problems in the past. Could not figure it out even after many calls with Salesforce support. All it matters is whether you are able to successfully deploy or at least validate deployment. You can try creating a simple change set and validate deployment. 
Mudasir WaniMudasir Wani
Hello Guys,

This is aproblem with salesforce Developer console.
Eclips gives you the exact coverage.

Please mark this as solution if this solves your problem, So that if anyone has this issue this post can help
Mason StaerkelMason Staerkel
That is kind of what I was afraid of. Good thing the IDE that they do not control at least works. Surprise suprise they won't fix their own issue. Thanks for the replies.