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

chedule test class
Hi,
I write a schedule :
global class Sch01 implements Schedulable{
global void execute(SchedulableContext sc) {
AccountOwnerReassignment acc = new AccountOwnerReassignment();
database.executebatch(acc);
}
}
and this test class;
static testmethod void t62()
{
Test.startTest();
Sch01 sh = new Sch01();
String sch = '0 0 5 * * ?';
system.schedule('Schedule TEST', sch, sh);
Test.stopTest();
}
Ihave this error :Save error: Method does not exist or incorrect signature: Test.startTest().
Please, what is the problem??
thanks!
M.H
Change the name of the class, it can't be called 'Test' because you are overriding the system class.
Next time, googling the error might help you too.
I renamed the class and it was the same problem!
Make sure you first manage to save the class with a different name, and then edit it with the new test method.
If that doesn't work, Copy & Paste the whole class code so we can see it.
This is my code of class test:
@isTest
private class test {
/***************************************************************************************************************************/
public static testmethod void t1()
{
commission_et_frais_par_catalogue__c comFraisCat = new commission_et_frais_par_catalogue__c
(Code_catalogue__c='test');
insert comFraisCat;
}
/****************************************************************************************************************************/
/****************************************************************************************************************************/
public static testmethod void t2()
{
AccountOwnerReassignment ch = new AccountOwnerReassignment();
Database.executeBatch(ch);
//Database.executeBatch(new AccountOwnerReassignment());
}
/****************************************************************************************************************************/
public static testmethod void t3()
{
Sch01 sh = new Sch01();
Datetime dt = Datetime.now();
String sch = '0 '+dt.minute()+' * '+dt.day()+' '+dt.month()+' '+' ? '+dt.year();
system.schedule('Schedule',sch,sh);
}
}
and this is my code of schedule class
global class Sch01 implements Schedulable{
global void execute(SchedulableContext sc) {
AccountOwnerReassignment acc = new AccountOwnerReassignment();
database.executebatch(acc);
}
}
noted: AccountOwnerReassignment is an batch class!
thanks.
Your class is still called 'test'
I renamed "private class test" by " private class testMethode"
i have a new error: "Save error: Type is not visible: test"