+ Start a Discussion
mba75mba75 

best pratice to avoid governor limit in unit test

My unit test reach the governor limit of 100 SOQL query.

 

what is the best practice to divide the unit test and reset the governor limit to 0 ? ( in the same time I want to keep my the account opportunity ... that i have create at the beginning of my test ).

 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
WesNolte__cWesNolte__c

Hey

 

Please post a bit of code.. there are some common gotcha's that get almost everyone in the beginning. Unit tests should be just that, they should test one method of a class. You can handle all your data initialisation in a static method that your unit test method calls.

 

Wes