+ Start a Discussion
ChinnoyChinnoy 

Help me on this Test Class..

VF Page:

<apex:page controller="AccountController1" id="pg" >
            <apex:form id="form">
            <apex:pageBlock title="Recent Accounts" id="pbs">
                  Name:  <apex:inputField value="{!Account.name}"  id="name"/> 
                  <br></br> 
                  phone:  <apex:inputField value="{!Account.phone}" id="phone" />
                     <br></br> 
                   <apex:commandButton value="save" action="{!save}"/>           
                  </apex:pageBlock> 
                  <apex:pageBlock >
                  Name:<apex:outputField value="{!Account.name}" id="o1"/>
                    <br></br> 
                  phone:<apex:outputField value="{!Account.phone}" id="o2"/>
                  </apex:pageBlock> 
                  </apex:form>
                  <script>
                  document.getElementById(pg:form:pbs:01:o2).value= document.getElementById(pg:form:pbs:name:phone).value;
                  </script>
                  </apex:page>


Controller:

public without sharing class AccountController1 {
    public Account account{get; set;}
    public AccountController1(){
        account = new Account();
    }
    
    public void save(){
        upsert account;
    }
}


PLease help me on this...
Best Answer chosen by Chinnoy
Apoorv Saxena 4Apoorv Saxena 4
Hi Venkat,

Here is your test class code :
 
@isTest
public class AccountController1Test{
    static testMethod void testMe(){
       
        AccountController1 ac = new AccountController1();
        ac.account.name='Test Acc';
        ac.save();
    }
}

Please mark this question as solved if this answers your question so that others can view it as proper solution.

Thanks,
Apoorv