How to write test class for Database.QueryLocator in Batch Apex?

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);           
        AU.execute(BC, AcctList);

No comments:

Post a Comment

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

submit to reddit