I have a whole slew of testMethods in an AccountTriggerHandlerTest class. When I run the class as a whole, I get about 60% coverage, and it shows me that I'm missing one of my trigger methods. However, when I run the testMethod that exclusively applies to covering that trigger method, it correctly shows that it covers that testMethod. Why would it not cover it when run in aggregate but cover it when run in isolation? I have parallel testing disabled...

1 Answer 1


Are you relying on specific data in the org? (i.e. using seeAllData=true). If so, that could be interfering if something else is updating a record that trigger is also using. Sounds more like a problem (bug) with the test coverage reporting though; I suspect in cases where it's vital (i.e. deploying) the coverage will be calculated correctly.

  • No, I never use seeAllData=true... It did deploy fair enough, but my other coverage was high enough that it wouldn't have made a difference either way. The odd thing is that even in production, when I "Run All Tests" it still shows the low coverage on that class... Mar 31, 2014 at 1:16
  • 1
    There's been heaps of issues with reporting of code coverage recently. Maybe try moving that method to a different class to see if the results are more reliable?
    – Matt Lacey
    Mar 31, 2014 at 1:22
  • Sadly, that was the answer... 100% code coverage now. Seems sloppy of salesforce to force that. I'm not happy with class skew simply because their algorithms don't work properly... Mar 31, 2014 at 14:30

You must log in to answer this question.

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