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
Sahil YadavSahil 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 !!!');


Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sahil,

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.

Sahil YadavSahil Yadav
Test Class Code

@isTest public class integrationLogBatchScheduleTest {
    @isTest public static void testCreateData(){
        List<Integration_logs__c> integrationLogsList = new List<Integration_logs__c>();
        for(integer i = 1; i < = 190;i++){
            Integration_logs__c il = new Integration_logs__c();
            // = 'Test Integration Logs'+i;
            integrationLogBatchClass ilb = new integrationLogBatchClass();
        insert integrationLogsList;

In Error : 
System.AsyncException: You've exceeded the limit of 100 jobs in the flex queue for org 00D750000004eiz. Wait for some of your batch jobs to finish before adding more. To monitor and reorder jobs, use the Apex Flex Queue page in Setup.

SlackTrace :
Class.integrationLogBatchScheduleTest.testCreateData: line 16, column 1

AbhinavAbhinav (Salesforce Developers) 
Check this: