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

implement test class to schedule!
Hi,
i coded in this schedule class and i add in my test class, but i have 0% couverd in my schedule class!
this is my schedule:
global class Sch01 implements Schedulable{
global void execute(SchedulableContext sc) {
AccountOwnerReassignment acc = new AccountOwnerReassignment();
database.executebatch(acc);
}
}
and this is my test class:
@isTest
private class test {
public static testmethod void t63()
{
Sch01 sco = new Sch01();
String sch = '0 0 23 * * ?';
system.schedule('Contract Creates', sch, sco);
}
}
please, where is the problem?
thanks.
Here is a test class for scheduled apex classes.
modify to suit your needs
Put this line in your Scheduled apex class
All Answers
Add these lines to test class:
AccountOwnerReassignment acc = new AccountOwnerReassignment();
sch.execute(acc );
i have this error:
Save error: Method does not exist or incorrect signature: [String].execute(BalanceCalculBatch)
at level :sch.execute(acc );
Here is a test class for scheduled apex classes.
modify to suit your needs
Put this line in your Scheduled apex class
I have 25% of my schedule class covered! ;only this ligne ( public static String CRON_EXP = '0 0 0 3 9 ? 2022';)
the other lignes is not covered!
you have a solution?
thanks.
Cannot do anything with seeing your code.
Post:
1. Name of your batch class
2. Code of your batch schedule class
3. Code of the test class
Thanks, i have rename my test class and add Test.startTest(); and Test.stopTest(); to my code, now i have 79% covered.
thank you.