0

My estimated overall code coverage is 56%. However, all of my files other than my 2 unit test classes are touched by my tests, and the lowest percentage covered of any of those is 84%. I would like to believe that this means my test coverage is at least 75%, but the only way I've found to find out is to go through a bunch of steps to do a test deployment (change sets in my case; my IDE'd don't contain all the metadata so I assume I couldn't use them for a test deployment).

enter image description here

Is there some way I can get an estimate that's roughly close to accurate (say w/i 10%) without having to do some process that's at least 10 steps long?

The developer console Suite Manager says 56% overall. I also have available Eclipse and IntelliJ with Illuminated Cloud. I believe I am hitting Apex Code Coverage: Test classes are included with 0% in overall code coverage calculation. My test classes are almost as long as my actual code, so 56% is plausible including those.

1
  • Both of the test classes are marked with @isTest. – Paul Feb 2 '16 at 23:25
1

You're thinking about this wrong, yes your trigger needs to have at least 75% coverage but with the current patterns that most of us use you will always hit that, you need to hit all the business logic that may come about and ensure that all your classes get covered. I haven't seen any of your code, but with the current patterns that most developers are using you should have 100% on triggers and damn close to 100% with your classes. Ensuring that you have proper class coverage is on you because Salesforce won't pick it up on deployment..

The only thing that my test code doesn't cover is my catch blocks and that is what I strive for. So I would say stop analyzing the numbers so close and closely check your test classes for validity. But I may be wrong and post your test code so we can help you more..

2
  • Thanks, that's very helpful. I'm most of the way through the changeset deployment process, so I may try to just finish that up if I get exclusive org access. I test all of the actual business logic and verify failure in some of the exception cases. I didn't use try/catch much in my triggers. (Sadly, my most important error handling test currently fails production validation and I may have to back it out temporarily so I can get something deployed.) – Paul Feb 3 '16 at 13:38
  • Ultimately, I had to just try deploying and it succeeded. Since this involves either halting production or paying for a second sandbox, I think SalesForce should improve this. – Paul Mar 8 '16 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.