7

I have about 50 classes and triggers with only 6 of them < 100%. My code coverage is almost always around 90%. I compiled, re-ran tests via the Apex Test Execution page, and then estimated my org's code coverage and it comes out to 65% now. As you can see from the pic, all classes and triggers listed are in order by code coverage % asc.

I'm hoping that I'm just overlooking something simple here. Why would my coverage drop so much, yet show that most all at 100% or 80% and higher?

enter image description here

4
  • what is the over all coverage if you run all test class using force.com IDE ?
    – Ian Roque
    Dec 28, 2013 at 0:12
  • Have you tried just to deploy classes? Sometimes it gives wrong values. Just try validate your Change Set. Dec 29, 2013 at 16:02
  • @Chiz, yes and fails due to coverage.
    – fourq
    Dec 29, 2013 at 16:23
  • I don't know @IanRoque I haven't downloaded, but that's a good idea. I will try on both Mavensmate and forceide to see if that makes any difference. Thanks.
    – fourq
    Dec 29, 2013 at 16:25

2 Answers 2

4

While it's a different issue I wonder if this might be the same root cause as another question I saw not too long ago that arose from invalid/corrupt test history data.

Try clearing your apex test history and see if that restores sanity to the numbers. More details: Why do Apex Unit Test CLASSES sometimes FAIL when all the contained METHODS PASS?

4
  • 1
    Well, I tried clearing it, and rerunning, but now it's at 64%. lol
    – fourq
    Dec 27, 2013 at 21:56
  • 1
    I didn't know about the test history and the ability to clear it though. So thanks!
    – fourq
    Dec 27, 2013 at 22:00
  • After removing test history, and rerunning tests. The chatter answers test page that gets included my my classes after enabling, went down to 35%. dl.dropbox.com/u/89363347/code_coverage2.jpg
    – fourq
    Dec 27, 2013 at 22:06
  • 1
    Well, I'm out of good ideas then. That's quite odd. Time for a case? Dec 27, 2013 at 22:37
4

So my issue ended up being a class that was completely commented out, including the test class. So it was showing 271 not covered, but it wasn't obvious at all. Once uncommented, I was right back up in code coverage. #$%^!

Thanks for all the suggestions everyone.

3
  • 1
    Fourq, if any answer helped out, or was the solution, you can "accept it" with the checkmark button to the left of it. Even your own answer, so that the question will be shown as answered. Dec 30, 2013 at 10:36
  • @Sdry, your own answer can be accepted after 2 days.(Not sure about it though). Dec 30, 2013 at 12:01
  • Yep, I've seen this with old classes in production that I meant to delete and forgot about. They'd be completely commented besides the class definition itself. It appeared to be counting heavily against code coverage. Nov 24, 2014 at 22:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .