+ Start a Discussion

test class to insert Account record

Description: Class to insert Account record.
public class InsertAccountRecord {
    Function- insertRecord
    @param - Number of Record to be inserted
    public void insertRecord(Integer numberOfRecord )
    List<Account> listAccount = new List<Account>();
    Account accountObject;
        for(Integer i=0;i<=numberOfRecord;i++){
        accountObject = new Account(name='Account'+i);
    insert listAccount;
Abdul KhatriAbdul Khatri
public class AccountTest {

    @isTest static void testAccountInsert() {
        InsertAccountRecord acctinst = new InsertAccountRecord();

        system.assert([Select Id From Account].size()==3);

Abdul KhatriAbdul Khatri
Hey man, aren't you following up on this? Please let me know if my answer helped you. If Yes, please mark it a best.