Activity › Forums › Salesforce® Discussions › How to use System.RunAs in test class in Salesforce? Salesforce® Discussions How to use System.RunAs in test class in Salesforce? Posted by Deepak on May 15, 2020 at 4:49 PM How to use System.RunAs in test class in Salesforce? Kirandeep replied 6 years ago 2 Members · 1 Reply 1 Reply Kirandeep Member May 15, 2020 at 5:23 PM The system method, System. runAs(),lets us write test methods that change user contexts to either an existing user or a new user. All of that user’s record sharing is then enforced. You can only use runAs in a test method Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me