function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dianna Raquel Perez GüerequeDianna Raquel Perez Güereque 

SCHEDULED CLASSES

Is there a way to test schedulable classes without programming an apex class job?

Like in test classes that we have the "run" button.
i need to wait 1 hour to test my schedulable class every time i need to change something. 

I made my schedulable class a trigger to test it, the trigger is working... the schedulable class not. 
Also is not showing me debugs on the log after running. 

and I'm getting crazy.

Thanks for the help!.
Best Answer chosen by Dianna Raquel Perez Güereque
Shashikant SharmaShashikant Sharma
Hi Dianna,

You could do by two ways:
  1. The code that you have in Schedule Class execute method put it out in another Public method and call that method from Developer Console
  2. You could run the following code in deeloper console:                                                                                                                                                        Change the Apex Class Name 
    dateTime dt=System.now().addMinutes(10); //you can specify 10 mins or 15     
                                                                                  //mins or any interval
                String Csec,Cmin,Chr,Cday,Cmonth,CYear;
                Csec=String.valueof(dt.second());
                Cmin=String.valueof(dt.minute());
                Chr=String.valueof(dt.hour());
                Cday=String.valueof(dt.day());
                Cmonth=String.valueof(dt.month());
                CYear=String.valueof(dt.Year());
                String SchTimer=Csec+' '+Cmin+' '+Chr+' '+Cday+' '+Cmonth+' ? '+CYear;
                system.debug('*************SchTimer:'+SchTimer);
                Scheduler02 cas = new Scheduler02();
                system.schedule('Scheduler02: Running at '+System.now().format(), SchTimer, cas);

                                                                                                                                                                                                          like this : http://salesforce.stackexchange.com/questions/82526/how-to-run-apex-scheduler-job-class-via-developer-console 

Thanks
Shashikant