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
AtnMAtnM 

Test Users in Test Methods

Hi,

 

I'm hoping there's a simple solution to the problem I'm running into. To write my tests so that they are  independent of any organization, I would like to create new test users in my test methods and then use RunAs to verify expected behavior as the different types of users. The problem I'm running into is that if an organization has maxed out their licenses I can't create the users for my tests. Is there anyway to get around this?

 

Thanks in advance for any help!

 

Scott

Best Answer chosen by Admin (Salesforce Developers) 
BrianWKBrianWK
You could try creating your test users but make them "inactive" They should still work for your test - but since they're inactive it won't count against your organization's license cap.