@isTest private class DeleteSObjectBatchTest { static testMethod void testMethod1() { Product2 prd1 = new Product2(); prd1.ProductCode_Ext__c = 'HistoryPrd1'; prd1.ProductCode = 'HistoryPrd1'; prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; prd1.Name = 'HistoryPrd1'; prd1.Manual_Entry__c = false; prd1.Extend_new_product_gurantee__c = true; prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); prd1.Extend_Gurantee_End__c = Date.today().addDays(60); insert prd1; Id execBTId1 = Database.executeBatch(new DeleteSObjectBatch('Product2'), 100); // Id execBTId2 = Database.executeBatch(new DeleteSObjectBatch('Contact','LastName = \'lastName\''), 100); // DeleteSObjectBatch b = new DeleteSObjectBatch(); } static testMethod void testMethod2() { Product2 prd1 = new Product2(); prd1.ProductCode_Ext__c = 'HistoryPrd1'; prd1.ProductCode = 'HistoryPrd1'; prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; prd1.Name = 'HistoryPrd1'; prd1.Manual_Entry__c = false; prd1.Extend_new_product_gurantee__c = true; prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); prd1.Extend_Gurantee_End__c = Date.today().addDays(60); insert prd1; Id execBTId1 = Database.executeBatch(new DeleteSObjectBatch('Product2','ProductCode = \'lastName\''), 100); // Id execBTId2 = Database.executeBatch(new DeleteSObjectBatch('Contact','LastName = \'lastName\''), 100); // DeleteSObjectBatch b = new DeleteSObjectBatch(); } }