function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kathyanikathyani 

Test Method: System.Exception

Hi,

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,
kathyani



mikefmikef
split them into different testMethods.

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