You need to sign in to do that
Don't have an account?
Pinky 10
Hi.. i wrote below test class for Schedulable class and it is giving me error
@isTest
private class TestCheckJitterbitExtract {
static testMethod void myUnitTest() {
Test.startTest();
Batchaccountcountfieldschedule sh1 = new Batchaccountcountfieldschedule();
String sch = '0 0 2 * * ?';
system.schedule('Test Territory Check', sch, sh1);
Test.stopTest();
}
}
for
global class CheckJitterbitExtract implements Schedulable{
global void execute(SchedulableContext SC) {
boolean jobRanOK = false;
DateTime dt = DateTime.now().addHours(-5);
for(LoginHistory lh : [Select Status, LoginTime, Application From LoginHistory where LoginType = 'Partner Product' and UserId = '00560000001brWwAAI' and LoginTime > :dt]){
if(lh.Status == 'Success' && lh.Application.contains('Jitterbit')){
jobRanOK = true;
}
}
if(!jobRanOK)
throw new JitterbitException('Please check Jitterbit to investigate a possible issue with ToBe extract as there was no connection made to SF today.');
}
}
private class TestCheckJitterbitExtract {
static testMethod void myUnitTest() {
Test.startTest();
Batchaccountcountfieldschedule sh1 = new Batchaccountcountfieldschedule();
String sch = '0 0 2 * * ?';
system.schedule('Test Territory Check', sch, sh1);
Test.stopTest();
}
}
for
global class CheckJitterbitExtract implements Schedulable{
global void execute(SchedulableContext SC) {
boolean jobRanOK = false;
DateTime dt = DateTime.now().addHours(-5);
for(LoginHistory lh : [Select Status, LoginTime, Application From LoginHistory where LoginType = 'Partner Product' and UserId = '00560000001brWwAAI' and LoginTime > :dt]){
if(lh.Status == 'Success' && lh.Application.contains('Jitterbit')){
jobRanOK = true;
}
}
if(!jobRanOK)
throw new JitterbitException('Please check Jitterbit to investigate a possible issue with ToBe extract as there was no connection made to SF today.');
}
}
If your test class will fail then please post the screen shot of error
All Answers
I think you are creating this test class for schedule class CheckJitterbitExtract but in your test class you have used different name.
Kindly check .I think you need to use system.schedule('Test Territory Check', sch, new CheckJitterbitExtract () );
1) https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm
Please try below Scheduler Test class
Please try below test class
Let us know if this will help you
JitterbitException: Please check Jitterbit to investigate a possible issue with ToBe extract as there was no connection made to SF today.
If your test class will fail then please post the screen shot of error