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
MadhulendraMadhulendra 

Need Help to wirte Test Class For Update Record

hi , I have written a method updateRecord for Controller Class. the funcionality of this

method is to update record. but how I can write a Test Class for this method. can

anybody help me.

 

 

public PageReference updateRecord()

{

ApexPages.Message myMsg=null;

try

{

for(CustomerFinancialDetail__c cfd : updateInsuredParty)

{

Database.SaveResult[] sr = Database.update(updateInsuredParty);

for(Database.SaveResult sr1 : sr)

if(sr1.isSuccess())

{

myMsg = new ApexPages.Message(ApexPages.severity.CONFIRM,'Record Saved Sucessfully','');

ApexPages.addMessage(myMsg);

}

}

}

catch(Exception e)

{

   system.debug('Exception Caught --->'+e.getMessage());

}

}

}

 

Thanks in advance

Cool_DevloperCool_Devloper

This will get you started-

 

APEX Code Coverage Methods

 

Cool_D