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
Raja.PRaja.P 

I need some help in writing test class

Hii Friends

I am not familiar  at writing test clas i got arequirement
so please kindly  help me in writing this test class

this  is my class 

public class EF_Approval_Utility {
  public static string currentuser;
  public EF_Requested__c efreq = new EF_Requested__c();
  public List<EF_Request_Approve_Controller.EF_ApprovalHistory> lstApprovalHistory {get;set;}
  public EF_Approval_Utility()
  {
   
  }
  public void captureApprovalHistory(List<EF_Request_Approve_Controller.EF_ApprovalHistory> approvalHistory, String Id)
  {
    try
    {
    String historyfield='';
    for(EF_Request_Approve_Controller.EF_ApprovalHistory ah:approvalHistory)
    {
       String s = '';
       s = ah.CreatedDate +''+ah.AssignedTo+''+ah.RequestorComments+ah.ApprovedRejectedBy+ah.ApproverComments;
      historyfield = historyfield+s;
    }
    efreq = [Select Approval_Comments__c from EF_Requested__c where Id=:Id];
    efreq.Approval_Comments__c=historyfield;
    update efreq;
    }catch(Exception e)
    {
      Apexpages.addMessages(e);
    }
  }
}




Thanks in advance 
Best Answer chosen by thisisnotapril
bob_buzzardbob_buzzard
There's a good article to get you started with test methods at:

http://wiki.developerforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

All Answers

bob_buzzardbob_buzzard
There's a good article to get you started with test methods at:

http://wiki.developerforce.com/page/An_Introduction_to_Apex_Code_Test_Methods
This was selected as the best answer
Katia HageKatia Hage
The wiki is a good intro to Apex tests.
Also, the Apex quickstart also has a step that shows how to add a test class: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_qs_test.htm|StartTopic=Content%2Fapex_qs_test.htm|SkinName=webhelp