+ Start a Discussion

Test Method: System.Exception


I am creating a test method where I am saying insert department, insert employee, insert deviceservice, insert bill. This calls department trigger code, employee trigger code, billbefore and billafter trigger code.  As it calling so many triggers there is lot of code that is getting executed. From apex debugger I am seeing that there are lot of rows retrieved from all these SOQL queries that are defined in all these triggers. So it retrieves lot of SOQL rows. Because of this I am getting System.Exception.

I do not want to add limit in any of the SOQL queries. Is there any other way to solve this. Is there a way that I can tell it to not execute code that is not required. or Do I need to split these into different test methods?

Thanks in advance,

split them into different testMethods.

and/or re factor your code so your queries bring back a more concentrated data set.