You need to sign in to do that
Don't have an account?

test case help
how to write test case for this class
global class WOW_InventoryAgeing implements schedulable
{
global void execute(SchedulableContext sc)
{
WOW_InventoryAgeing_BatchClass b1 = new WOW_InventoryAgeing_BatchClass(); //ur batch class
database.executebatch(b1,180);
}
}
Hi,
try thebelow code snippet as reference:
global class WOW_InventoryAgeing implements schedulable
{
global void execute(SchedulableContext sc)
{
WOW_InventoryAgeing_BatchClass b1 = new WOW_InventoryAgeing_BatchClass(); //ur batch class
database.executebatch(b1,180);
}
public static testMethod void WOW_InventoryAgeing()
{
Test.startTest();
WOW_InventoryAgeing m = new WOW_InventoryAgeing();
String sch = '0 0 10 ? * MON-FRI';
String jobId =system.schedule('Merge Job', sch, m);
system.debug('###'+jobId);
// Get the information from the CronTrigger API object
CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered,
NextFireTime FROM CronTrigger WHERE id = :jobId];
Test.stopTest();
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Hi,
try thebelow code snippet as reference:
global class WOW_InventoryAgeing implements schedulable
{
global void execute(SchedulableContext sc)
{
WOW_InventoryAgeing_BatchClass b1 = new WOW_InventoryAgeing_BatchClass(); //ur batch class
database.executebatch(b1,180);
}
public static testMethod void WOW_InventoryAgeing()
{
Test.startTest();
WOW_InventoryAgeing m = new WOW_InventoryAgeing();
String sch = '0 0 10 ? * MON-FRI';
String jobId =system.schedule('Merge Job', sch, m);
system.debug('###'+jobId);
// Get the information from the CronTrigger API object
CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered,
NextFireTime FROM CronTrigger WHERE id = :jobId];
Test.stopTest();
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
it works got 100 percent