+ Start a Discussion
viswsanathviswsanath 

how to write a test class

public class AddmultipleAccountsController
{
Account account = new Account();
public list<Account> listAccount{ get; set; }
public AddmultipleAccountsController()
{
listAccount=new list<Account>();
listAccount.add(account);
}
Public void addAccount()
{
Account acc = new Account();
listAccount.add(acc);
}
public PageReference saveAccount()
{
for(Integer i=0; i<listAccount.size(); i++)
{
insert listAccount;
}
return Page.Allaccountssaved;
}
}
Darshan FarswanDarshan Farswan
Hi Viswanath,

It will be a good learning experience for you if go through the Salesforce guides and links. To know more about writing the test classes for a Controller, here please refer to http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_error_handling.htm