You need to sign in to do that
Don't have an account?
Sahil Yadav
Hello mates I am stuck in for writting the test class for this batch class could anyone help out on this
public class integrationLogBatchClass implements Database.Batchable <sObject> { /* * the start methods basically queried out a list of records on which futher * DML operations is been get executed */ public Database.QueryLocator start(Database.BatchableContext bc){ return Database.getQueryLocator([SELECT Id, Name, OwnerId, IsDeleted, CreatedDate, RecordTypeId, CreatedById, SystemModstamp, LastReferencedDate, Response_Body__c, Status__c, Transection_Id__c, CRC_Response_Body__c, IntegrationType__c, Endpoint_URL__c, Transaction_Type__c, Sent_To__c, Sent_From__c, Request_Body__c, LastViewedDate, LastModifiedById, LastModifiedDate FROM Integration_logs__c where CreatedDate = Today ]); } /* * The execute method is entry point of execution for performing * DML operation in a batches or a small chunks of records * */ public void execute(Database.BatchableContext bc, List<Integration_logs__c> scope){ delete scope; /* for(Integration_logs__c il : scope){ delete il; } */ } /* * This is is the exit point for Batch Class Execution * which is been executed onle once * */ public void finish(Database.BatchableContext bc){ System.debug('the finish method of integration Log object is invoked !!!'); } }
Did you try to create a record for Integration_logs__c object with all tha mandatory fields and call the batch class in the test class?
Are you facing any issues while doing so. Please post if you are facing any errors in it.
If this solution helps, Please mark it as best answer.
Thanks,
https://salesforce.stackexchange.com/questions/244788/how-do-i-write-an-apex-unit-test
https://salesforce.stackexchange.com/questions/244794/how-do-i-increase-my-code-coverage-or-why-cant-i-cover-these-lines
Thanks!