Find your content:

Search form

You are here

Getting Code Coverage on a Class That Should Show Related Objects

 
Share

I have the following code: http://codepad.org/AavgIrHB and Salesforce says that with my two test cases I only have 42% coverage.

I feel I should have more, but it's not showing the latter part of the class, the part dealing with product areas and product categories, as being covered at all, which suggests to me that it is not actually seeing the linkage between the product and the contact by the line item object.

How would I put in assertions to confirm that my linkage is being made correctly? And if the assertions show up an issue, how would I resolve it?

Thanks for any assistance you are able to provide.


Attribution to: Evan Donovan

Possible Suggestion/Solution #1

It may be that exceptions are being thrown during the test cases and then converted into page messages by the handling code.

Try adding assertions after your Test.stopTest(); lines.

System.assert(!ApexPages.hasMessages(), ApexPages.getMessages());

Attribution to: Daniel Ballinger
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5361

My Block Status

My Block Content