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
shra1_devshra1_dev 

REG: Using system.runAs() in test Classes

Hi Dev,

 

I have running the code in Test Class using system.runAs(User). Actually runAs(User) won't consider the License limits. 

 

But when i run my test class i am getting the license limitation. What could be the reason for this?

 

 

Help me...  Mine is an Enterprise Edition..Does this make a diff?

 

 

Regards,

Shravan

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

System.runas(User) considers License limits.

 

 

Prior to Spring '11, governor limits worked in two contexts. Different amounts of resources were allocated for a limit depending
on where the code originated. For Spring '11, there is a single context. All governor limits have the same amount of resources
allocated to them, regardless if you're calling it from trigger, an anonymous block, a test, and so on.

 

Prior to Spring '11, governor limits worked in two contexts. Different amounts of resources were allocated for a limit depending on where the code originated. For Spring '11, there is a single context. All governor limits have the same amount of resources allocated to them, regardless if you're calling it from trigger, an anonymous block, a test, and so on.

 

 

No longer a separate limit :

 

The following methods no longer have a separate limit. Calls to these methods now counts against the total number of

the specified method.

 

Method - Counts against

 

rollback - Total number of DML statements issued

runAs - Total number of DML statements issued

setSavepoint - Total number of DML statements issued

findSimilar - Total number of SOSL queries issued

 

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page