Find your content:

Search form

You are here

Inconsistent Test Code Coverage

 
Share

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


Attribution to: Nathan Williams

Possible Suggestion/Solution #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.


Attribution to: Matt Lacey
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/31357

My Block Status

My Block Content