You need to sign in to do that
Don't have an account?
Test coverage
Not able to get coverage for the below code in bold.
global class RS_DeleteExportRecords implements Database.Batchable<sObject>, Schedulable{
global final String Query;
global RS_DeleteExportRecords (){
}
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator([select id from RS_Export__c where CreatedDate != Today]);
}
global void execute(Database.BatchableContext BC,List<RS_Export__c> scope){
delete scope;
}
global class RS_DeleteExportRecords implements Database.Batchable<sObject>, Schedulable{
global final String Query;
global RS_DeleteExportRecords (){
}
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator([select id from RS_Export__c where CreatedDate != Today]);
}
global void execute(Database.BatchableContext BC,List<RS_Export__c> scope){
delete scope;
}
NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
Try below code:
Please let me know if the helps.
As a common practice, if your question is answered, please choose 1 best answer. Additionaly you can give every answer a thumb up if that answer is helpful to you.
Thanks,
Arun
As per your Batch job you are fatching all "RS_Export__c" record which created date is not today In your test class you can not control the createdDate So please modify your Batch job like below then try below test class.
Please try below test class. Please let us know if this will help you