You need to sign in to do that
Don't have an account?
sfdc development hints
Hi can anyone please helpme to write a test class for the below code
global class ClsTargetedCalls_ExecuteBatch implements Schedulable
{
global void execute(SchedulableContext sc)
{
System.debug('Before Execution');
ClsTargetedCalls objclsTargetedCalls = new ClsTargetedCalls();
System.debug('After Execution');
database.executebatch(objclsTargetedCalls);
}
}
Hello,
@isTest
static void testScheduler()
{
Test.startTest();
String jobId = System.schedule('testTargetedCallsBatchSchedule',
'0 0 0 15 10 ? 2012',
new ClsTargetedCalls_ExecuteBatch());
Test.stopTest();
}
All Answers
You will have to shcedule the schedulable class from the test class itself programmatically to cover the case.
Example is given over here-
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
Hello,
@isTest
static void testScheduler()
{
Test.startTest();
String jobId = System.schedule('testTargetedCallsBatchSchedule',
'0 0 0 15 10 ? 2012',
new ClsTargetedCalls_ExecuteBatch());
Test.stopTest();
}