You need to sign in to do that
Don't have an account?
Daniel B Probert
Schedule Test Class 57%
Hi Anyone able to tell me what's wrong with my test class.
here is my schedule:
global class MFHourlyScheduler implements Schedulable{ global MFHourlyScheduler (){} public static void start(){ String mfsch = '0 0 13 * * ?'; System.schedule('Forms Update', mfsch, New MFHourlyScheduler()); } global void execute(SchedulableContext ctx){ MFUpdateBatch b = new MFUpdateBatch(); database.executebatch(b); } }
and here is my test class:
@istest class TestMFSchedule { static testmethod void test() { Test.startTest(); String mfsch = '0 0 13 * * ?'; system.schedule('Forms Update', mfsch, New MFHourlyScheduler()); Test.stopTest(); } }
i get it to 57% with this being marked as now being tested:
public static void start(){ String mfsch = '0 0 13 * * ?'; System.schedule('Forms Update', mfsch, New MFHourlyScheduler());
any ideas appreciated.
dan
Here is the pattern I use for scheduled classes and tests. Only will work until the year 2022 though so you may need to update it to be dynamic