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
RahulRahul 

Hi can you help me with test class of this batch apex

global class BatchLeadtUpdate implements Database.Batchable<sObject>, Database.AllowsCallouts{
    global Database.QueryLocator start(Database.BatchableContext BC) {
    Date myDate = date.newinstance(2018, 5, 1);
Date myDate2 = date.newinstance(2018, 7, 31);
        String query = 'Select name,id from Lead where CreatedDate>: myDate and CreatedDate <:  myDate2';
        system.debug('Records in this query'+Query);
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<sObject> scope) {
  
        List<Lead> leadls = (List<Lead>)scope; 
        for (lead l1 : leadls) {
            set<id> leadIds = new set<id>();
            leadIds.add(l1.id);
            BD_LeadTriggerHandler.syncLeadRecordsWithBENew(leadIds, false);
            l1.Batch_Updated__c = false;
        }
        update leadls;
    }   
    global void finish(Database.BatchableContext BC) {
    }
}