You need to sign in to do that
Don't have an account?
KMK91
Test Data for AsyncApexJob
Hi Team,
Can you any help me on this i'm creating test data to cover the code for AsyncApexJob Bactch class but it is not covering.
public Database.QueryLocator start(Database.BatchableContext BC){
string soqlQuery = 'Select Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email,'+
'ExtendedStatus from AsyncApexJob where Status = \'Failed\'';
/*
AsyncApexJob jobInfo = [Select Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email, ExtendedStatus from AsyncApexJob where Status = : 'Failed' limit 1];
system.debug('AsyncApexJob:' + jobInfo) ;
*/
if(test.isRunningTest()) {
soqlQuery +=' limit 1';
}
return database.getQueryLocator(soqlQuery);
}
Can you any help me on this i'm creating test data to cover the code for AsyncApexJob Bactch class but it is not covering.
public Database.QueryLocator start(Database.BatchableContext BC){
string soqlQuery = 'Select Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email,'+
'ExtendedStatus from AsyncApexJob where Status = \'Failed\'';
/*
AsyncApexJob jobInfo = [Select Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email, ExtendedStatus from AsyncApexJob where Status = : 'Failed' limit 1];
system.debug('AsyncApexJob:' + jobInfo) ;
*/
if(test.isRunningTest()) {
soqlQuery +=' limit 1';
}
return database.getQueryLocator(soqlQuery);
}
Thank you for Responding but i'm unable to cover this condition "where Status = \'Failed\'';"
Thanks
KMK