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
mukesh khandvemukesh khandve 

How Create Test class

global class DailyLeadProcessor implements Schedulable{    
global void execute(SchedulableContext ctx){        
List<lead> newLead=new List<Lead>([Select Id,LeadSource from Lead where LeadSource!=null ]) ;        
if(!newLead.isEmpty()!=null){            
for(Lead l:newLead){                
l.LeadSource='Dreamforce';          
  }        
}    

}
}
PrasathPrasath
Hi Mukesh Khandve

Use the below code,
@isTest
public class testScheduleBatch{  
    
    @isTest public static void methodName(){
        Test.startTest();
        DailyLeadProcessor dLP = new DailyLeadProcessor();
        String sch = '0 0 2 * * ?';  //Cron
        system.schedule('Name of the Job', sch, dLP); 
        Test.stopTest();
    }  
    
}