You need to sign in to do that
Don't have an account?
sfdc_1
How to create Test class with code coverage of 75% in salesforce?
can some one help me to write test class for below code as i am new to salesforce so i don't have much idea related to test class.
public class permissionset {
public void testOCRmethod() {
List < PermissionSetAssignment > permissionSetList = new List < PermissionSetAssignment > ();
Id permissionSetId = [SELECT id FROM permissionSet WHERE Name = 'test1per'].id;
Set < String > profileSet = new Set < String > { 'test1' };
for (User u: [SELECT ID, UserRole.Name, Profile.Name, IsActive FROM User WHERE Profile.Name IN: profileSet AND IsActive = true])
{
PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = permissionSetId, AssigneeId = u.Id);
permissionSetList.add(psa);
}
upsert permissionSetList;
}
}
permi
public class permissionset {
public void testOCRmethod() {
List < PermissionSetAssignment > permissionSetList = new List < PermissionSetAssignment > ();
Id permissionSetId = [SELECT id FROM permissionSet WHERE Name = 'test1per'].id;
Set < String > profileSet = new Set < String > { 'test1' };
for (User u: [SELECT ID, UserRole.Name, Profile.Name, IsActive FROM User WHERE Profile.Name IN: profileSet AND IsActive = true])
{
PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = permissionSetId, AssigneeId = u.Id);
permissionSetList.add(psa);
}
upsert permissionSetList;
}
}
permi
Here is the slightly modified class.