You need to sign in to do that
Don't have an account?
SRI 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.
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.