You need to sign in to do that
Don't have an account?
Mahesh Nirmal
System.LimitException: Too many SOQL queries: 101 for test class.
I am getting the System.LimitException: Too many SOQL queries: 101 error for the test class. Is there any way to skip this exception in test class??
You can try checking this thread as it seems to have information regarding the same issue for quick reference below is the best answer mentioned in the link:
By using the Test.startTest() & Test.stopTest() you get 2X governer limits.
In nutshell you have 2 context.
1>out side of Test.startTest() & Test.stopTest() and
2>inside of Test.startTest() & Test.stopTest().
In both context you get separate limits.
To fix this issue what you will have to do is:
1>Optimize and see if you can reduce the queries in trigger
2>Reduce the number of objects you are inserting
3>You can skip unnecessary trigger execution by checking if trigger being 4>called by Test method if(Test.isRunningTest())
5>in worst case you can use SeeAllData = true [not recommended].
Link: https://salesforce.stackexchange.com/questions/105372/too-many-soql-queries-101-issue-with-unit-test-methods
I hope this helps and in case if you find this information useful can you please choose this as best answer so that it can be useful for others in the future.
Regards,
Anutej