How to test Batch Class's execute method alone in Salesforce?

Sample Code:

sObject__c sObj = [SELECT Id, FROM sObject__c WHERE your_condition];
Database.BatchableContext bc;
BatchClass obj = new BatchClass();
obj.execute(bc, new List<sObject__c> {sObj});

Similarly you can test start and finish methods too.


No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit