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
Sfdc SivaSfdc Siva 

Need test class code coverage help

Hi Team,

Can any one please help me to create a test class.I have tried below testclass but i didn't get  any code coverage.please help me to increase code coverage.

@isTest

private class PartnerriggerTest
{
    Static testMethod void testPartnerTrigger()
    {
        Account acc = new Account(Name = 'newAcc');  
        insert acc;
        Contact con = new Contact(AccountId = acc.id,LastName = 'portalTestUser');
        insert con;
        Profile p = [select id from Profile where UserLicense.name = ' High Volume ' limit 1];
        User usr = new User();
        usr.LastName = 'TestUser';
        usr.Alias = 'tesUr';
        usr.Email = 'tstUsr@test.com';
        usr.UserName = 'tstUsr+11@test.com';
        usr.CommunityNickname = 'tsta211';
        usr.TimeZoneSidKey = 'America/New_York';
        usr.LocaleSidKey = 'en_US';
        usr.EmailEncodingKey = 'ISO-8859-1';
        usr.ProfileId = p.Id;
        usr.LanguageLocaleKey = 'en_US';
        usr.ContactId = con.Id;
      
        insert usr;
    }
}

Thanks
VamsiVamsi
Can you please post the Trigger or apex code that isn't covered ?
VamsiVamsi
Hi,

We should cause the trigger to initiate. So please create some Partner_Access__C  records and perform update to match the criteria 

 ******** if(Partner_Recd.Status__c=='Approved' && Partner_Recd.Status__c!=Trigger.oldMap.get(Partner_Recd.id).Status__c &&
                PRecd.id == Partner_Recd.id && PRecd.Approver_Comment_Check__c==true)  ********************
                {
                    set_Id.add(Partner_Recd.id);
                    strComment = PRecd.ProcessSteps[0].Comments;
                }
    *************            if(Partner_Recd.Status__c=='Rejected' && Partner_Recd.Status__c!=Trigger.oldMap.get(Partner_Recd.id).Status__c &&
                PRecd.id == Partner_Recd.id && PRecd.Approver_Comment_Check__c==true)*****************
                {
                    setrej_Id.add(Partner_Recd.id);
                    strComment = PRecd.ProcessSteps[0].Comments;
                }
VamsiVamsi
Please specify a different user name while creation of User 

   usr.UserName = 'tstUsr+11@test.com';
Sfdc SivaSfdc Siva
You mean't to say : usr.UserName = 'tstUsr+11@gmail.com'; ?
VamsiVamsi
Yes
Sfdc SivaSfdc Siva
I have used same one but still persisting same issue.Can you please help me. 

Thanks
VamsiVamsi
Hi,

Can you just ping me on mvamshikrishna99@gmail.com