+ Start a Discussion
samthakur74samthakur74 

System scheduled job not executing

Hello,

I have created a scheduler class. The Job itself  is registered with following code

 

public class TestInsertTaskScheduler
{
 public static testMethod void testInsertTaskScheduler()
 {
        scheduledInsert i = new scheduledInsert();
        Datetime now = Datetime.now();
        System.debug ('Datetime'+now);
       
        String sch = '00 1 * * * ?';  // scheduled to execute every minute
        system.schedule('Insert Task S3', sch, i);
        System.debug ('After schedule');
     
      }
}

The job does not display under Monitoring Seheduled Jobs.

 

Also the Job does not execute.

 

Could some one point out the obvious error? :)

 

Thanks
Sameer

public class TestInsertTaskScheduler
{
 public static testMethod void testInsertTaskScheduler()
 {
        scheduledInsert i = new scheduledInsert();
        Datetime now = Datetime.now();
        System.debug ('Datetime'+now);
        
        String sch = '00 1 * * * ?';
        system.schedule('Insert Task S3', sch, i);
        System.debug ('After schedule');
      
      }
}
Best Answer chosen by Admin (Salesforce Developers) 
kiranmutturukiranmutturu

testmethod jobs will never monitored  under Monitoring Seheduled Jobs. 

All Answers

kiranmutturukiranmutturu

testmethod jobs will never monitored  under Monitoring Seheduled Jobs. 

This was selected as the best answer
samthakur74samthakur74

Thanks,

So how do i invoke the code which i have currently written in test method? I could write it in another class and invoke that function from test method. But is that not the same thing?

Regards
Sameer