function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SRI HARSHA 32SRI HARSHA 32 

How to create a test class for a batch Apex with SOQL querying for Last modified date and Last Activity date ?

How to create a test class for a batch Apex with SOQL querying for Last modified date and Last Activity date ?              

global Database.QueryLocator start(Database.BatchableContext BC) {

String strStartNumberOfDays = '30';  
String strEndNumberOfDays = '60'; 

String query = 'SELECT Id,Name,Owner.name,Owner.Email FROM XYZ__c where' ;
query += ' Stage__c != \'ON-HOLD\'';
query += ' and LastActivityDate < LAST_N_DAYS:' +strStartNumberOfDays + ' and LastActivityDate >= LAST_N_DAYS:'+strEndNumberOfDays;
query += ' and LastModifiedDate < LAST_N_DAYS:' +strStartNumberOfDays + ' AND LastModifiedDate >= ST_N_DAYS:'+strEndNumberOfDays;

   return Database.getQueryLocator(query);
 }
Any Direction will be really Helpfull .

NOTE : if i use test.loaddata then the static file has been updated everytime to make sure that the test class passes.