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
Chitral ChaddaChitral Chadda 

vf page test class

i hav custon button "create deal" , which on click calls this action.
Name__c is a (look up fields to account) on test 1 object
<apex:page standardController="Test_1__c"   extensions="CreateDeal" >
<script type="text/javascript">
window.onload = function () {
//document.frmLead.sendButton.click();
dealInJS();
}
</script>
<apex:form > 
  
  <apex:pageMessages escape="false" />
  
  
     <apex:outputPanel layout="block" style="font-weight:bold;text-align:center"> 
         Converting Deal. Please wait...
     </apex:outputPanel> 
     
<apex:actionFunction action="{!deal}" name="dealInJS" >
</apex:actionFunction>
</apex:form>
</apex:page>


public class CreateDeal
 {
  
 
    private id accountId{get;set;} 
     public Test_1__c b{get;set;}

    
    public CreateDeal(ApexPages.StandardController controller) 
    {
    accountId= ApexPages.currentPage().getParameters().get('id');
    system.debug('+++'+accountId);
    }
    
    public  pageReference  deal()
    {
     Test_1__c  b = [Select id,Name__c,Name11__c,Number__c,Phone__c from Test_1__c  where id =:accountId];
     Test_2__c a = new Test_2__c();
     {
     
      a.Name11__c=b.Name11__c;
      a.Number__c=b.Number__c;
      a.Phone__c=b.Phone__c;
       a.Name__c=b.Name__c;
      }
      insert a;
    
    PageReference pageRef = new PageReference('/'+a.id);
    pageRef.setRedirect(true);
    return pageRef;
    }


}

how to write test class for this, i read few documentation but i cant prepare the test class
DeveloperSalesforceDeveloperSalesforce
Follow this link:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_error_handling.htm

 
Chitral ChaddaChitral Chadda
i cudnt gain,not much help