You need to sign in to do that
Don't have an account?
testMethod help for class that implements Schedulable
The documentation is usually pretty helpful but in this case it only added to my confusion. How the heck do I test this very simple class?
global class ideaCleanSchedule implements Schedulable{
global void execute(SchedulableContext sc){
ideaCleanBatch job = new ideaCleanBatch();
ID batchprocessid = Database.executeBatch(job,100);
}
}
I've been trying to do somethign like this with no luck.
Test.startTest(); ideaCleanSchedule job = new IdeaCleanSchedule(); //Line below as execut takes the argument of SchedulableContext but I'm stumped as to how to create this and pass it as an argument. job.execute(); Test.stopTest();
Thanks,
Jason
A class that implements Schedulabe can't be covered with tests.
So it looks like you'll have 5-6 lines that aren't covered. This class should call another class in which all processing is done. Tests should be written for this separate class. This is what I did but I still have issues.....
http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=22074
All Answers
A class that implements Schedulabe can't be covered with tests.
So it looks like you'll have 5-6 lines that aren't covered. This class should call another class in which all processing is done. Tests should be written for this separate class. This is what I did but I still have issues.....
http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=22074
I tried this and it got my test coverage to 100% --> http://community.salesforce.com/t5/Apex-Code-Development/Apex-Scheduler-Test/m-p/176917
This is what my code looks like
I didnt really care it what was executed in this test, because I have another test class that tests everything in the AccountClosed class