Posts

Showing posts with the label TestSetup

Salesforce Fact #709 | Assign PermissionSet in TestSetup()

Image
Suppose we need to test scenarios across multiple test methods in the context of a particular user and also a PS needs to be assigned to the user in order to gain access to required records. This is how we can create the user and assign the PS in TestSetup() method and in each test method we can fetch the user and use System.runAs(). Attached are the screenshots.