Article
Write Permission-Based Tests - Trailhead - Salesforce
trailhead.salesforce.com
Quoted on this wiki
Every place a page here uses this source, in the order the words come in it.
Execute your negative or positive test inside the System.runAs(user)block, as we’ve seen in units 3 and 4. “A permission set is a record detailing which permissions are granted.” The package you installed in unit 1 of this module contains a permission set called Private_Object_Access and a custom object whose default sharing is set to private. With that in place, let's look at what a permission-set test looks like.