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
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