Test Class for Batch Apex in Salesforce

Sample Batch Class:

Test class for above Batch Class:
public class AccountUpdateTest {
    static testMethod void test() {
        Database.QueryLocator QL;
        Database.BatchableContext BC;
        List<Account> AcctList = new List<Account>();
        AccountUpdate AU = new AccountUpdate('Name', 'Test');
        QL = AU.start(bc);
        Database.QueryLocatorIterator QIT =  QL.iterator();
        while (QIT.hasNext())
            Account Acc = (Account)QIT.next();           
        AU.execute(BC, AcctList);

1 comment:

  1. Good Work Bro !! Awesome thing to do. I tried the salesforce and it didn't worked out for me.


Sharing is Caring!!! Share this with your friends!!!

submit to reddit