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
Lightning UserLightning User 

Login as someone else

Hi, I'm making a test Apex class that checks against the current user profile. The problem is that there won't be enough code coverage if the user running the test is a system administrator. Is it possible to write apex code in the test class that logs in as a different user for the test, and it's still possible to run the test as a system administrator? Please help, thanks.
Best Answer chosen by Admin (Salesforce Developers) 

All Answers

Lightning UserLightning User
Thanks.