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
Nirmal9114Nirmal9114 

my test class not covering properly

@isTest
private class NBNAddUserToContact_test {
   
   
    private static testmethod void testUpdate() {
    
        NBNServiceSettings__c cs = new NBNServiceSettings__c();
        cs.name ='CreateUser';
        cs.Value__c ='Y';
        insert cs;
        
         NBNServiceSettings__c cs1 = new NBNServiceSettings__c();
        cs1.name ='CommunityUserEmail';
        cs1.Value__c ='testdummy@nbnco.com.au';
        insert cs1;
        
        user us = new user();
        us.LastName = 'tesst';
        us.FirstName = 'test272';
        us.LocaleSidKey = 'en_AU';
        us.TimeZoneSidKey = 'Australia/Sydney';
        us.ProfileID = '00e1a000000o1Vl';
        us.LanguageLocaleKey = 'en_US';
        us.EmailEncodingKey = 'ISO-8859-1';
        us.Email = 'nbn@nbnco.co.ac';
        us.Username = 'test22@gmail.com.nbndev01';
        us.WD_EmployeeNumber__c = '1232356223';
        us.Alias = 'tyre';
        us.CommunityNickname = 'test uuu';
        insert us;
        
        us.LastName = 'tess0t';
        update us;

    }
  private static testmethod void testInsert() {
        
     
        
       
        
        NBNServiceSettings__c cs21 = new NBNServiceSettings__c();
        cs21.name ='CreateUser';
        cs21.Value__c ='Y';
        insert cs21;
        
          NBNServiceSettings__c cs11 = new NBNServiceSettings__c();
        cs11.name ='CommunityUserEmail';
        cs11.Value__c ='testdummy@nbnco.com.au';
        insert cs11;
        
        account acct1 = new account(Name = 'NBNInc');
        
        contact con = new contact ();
        con.Contact_Source__c = 'WDSFDCIntegration';
        con.LastName = 'test';
        con.FirstName = 'test22';
        con.Accountid = acct1.id;
        con.email = 'nbn@nbnco.co.ac';
        con.Username__c = 'test@gmail.com';
        con.WDEmployeeNumber__c = '123232356223';
        con.WD_Employee_Type__c = 'Employee';
        con.Worker_Status__c = True;
        con.Nickname__c = 'test test22 tyre';
        con.Phone = '98959895';
        insert con;
              
    }
    
       private static testmethod void testInsertInactiveUser() {
        
       
        NBNServiceSettings__c cs3 = new NBNServiceSettings__c();
        cs3.name ='CreateUser';
        cs3.Value__c ='Y';
        insert cs3;
        
        NBNServiceSettings__c cs31 = new NBNServiceSettings__c();
        cs31.name ='CommunityUserEmail';
        cs31.Value__c ='testdummy@nbnco.com.au';
        insert cs31;
        account acctn = new account(Name = 'NBNInc');
        
        contact conInactive = new contact ();
        conInactive.Contact_Source__c = 'WDSFDCIntegration';
        conInactive.LastName = 'test';
        conInactive.FirstName = 'test22';
        conInactive.Accountid = acctn.id;
        conInactive.email = 'nbn@nbnco.co.ac';
        conInactive.Username__c = 'test@gmail.com';
        conInactive.WDEmployeeNumber__c = '1232356223';
        conInactive.WD_Employee_Type__c = 'Employee';
        conInactive.Worker_Status__c = False;
        conInactive.Nickname__c = 'test test22';
        conInactive.Phone = '98959895';
        insert conInactive;
   
    }

      
}
Chandra Sekhar CH N VChandra Sekhar CH N V
Which part is not covering? Can you post controller as well.
HARI KRISHNAHARI KRISHNA
Hi Tanya,
Your question is not clear.Make sure where the problem is exactly.So I can help you out.If possible post coloured code snippet then we can understand.Good luck.