You need to sign in to do that
Don't have an account?
chaithaly gowda
Batch class is not executing in test class
Hi
I have this code in my test class
User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
system.runAs(u){
Test.startTest();
ReminderController m = new ReminderController('30 Days Reminder');
String sch = '0 15 0 * * ?';
String jobID = system.schedule('Actions Job',sch,m);
Test.stopTest();
list<actions__c> sc=[select id from actions__c];
system.assertEquals(1, sc.size());
}
}
with this code... start ,execute method of batch class are not executing..
User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
system.runAs(u){
Test.startTest();
ReminderController m = new ReminderController('30 Days Reminder');
String sch = '0 15 0 * * ?';
String jobID = system.schedule('Actions Job',sch,m);
Test.stopTest();
}
}
and with this code... the batch class is running properly... I am not sure whats wrong.
Help needed to resolve this
,Thanks
I have this code in my test class
User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
system.runAs(u){
Test.startTest();
ReminderController m = new ReminderController('30 Days Reminder');
String sch = '0 15 0 * * ?';
String jobID = system.schedule('Actions Job',sch,m);
Test.stopTest();
list<actions__c> sc=[select id from actions__c];
system.assertEquals(1, sc.size());
}
}
with this code... start ,execute method of batch class are not executing..
User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
system.runAs(u){
Test.startTest();
ReminderController m = new ReminderController('30 Days Reminder');
String sch = '0 15 0 * * ?';
String jobID = system.schedule('Actions Job',sch,m);
Test.stopTest();
}
}
and with this code... the batch class is running properly... I am not sure whats wrong.
Help needed to resolve this
,Thanks
list<actions__c> sc=[select id from actions__c]; system.assertEquals(1, sc.size());
I wanted to do assert equals, but with these two statements, the batch class isnot getting called at all.