+ Start a Discussion

Too Many SOQL Queries: 101

I am currently working on getting test cases to work so I can start to alter the main code, however whenever I try to run my test cases they fail and I get the following error "too many SOQL queries: 101."  When I check to see where this error is occuring it points to the top of the program at "@isTest(SeeAllData=true)."  What does this mean , and how would I go about fixing the problem?
Well, any given transaction may only execute 100 SOQL queries.  Most common culprit is you are doing SOQL within a for loop. This is easy to spot by simply running with the debu log on and tracing the SOQL calls versus trigegrs/controlelrs or whatever you have under test.

Check out SFDC best practices under SOQL and bulkification - there are dozens of articles on this topic

It is possible this is not the issue and you simply have a too complex testmethod and need to break it into multiple methods.
Rahul SharmaRahul Sharma
seeAllData is by default false. BNy making it true, Test class relies on org's actual data. 
So, We should always create our test data in test class and never rely on the org's data.

Hope this helps!