You need to sign in to do that
Don't have an account?
viswsanath
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;
}
}
{
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;
}
}
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