I should see this debug: "Batch starts" but this debug does not exist. Variables didn't change too. What should I do so that I could see debugs and modify variables in the execute method? I have this code to run batch:
Database.executeBatch(new PatchPanelTriggerClassTestBatch());
And this is code for batch:
global with sharing class PatchPanelTriggerClassTestBatch implements Database.batchable<SObject> {
@TestVisible
private static Boolean flagForTest = false;
public static Integer toRemove = 0;
global void execute(Database.BatchableContext param1, List<Patch_Panel__c> param2) {
System.debug('Batch starts');
flagForTest = true;
for (Patch_Panel__c p : param2) {
System.debug(p.Name);
PatchPanelTriggerClass.deleteDuplicates(p.Name);
List<Interface__c> records = [SELECT Name, Id, Status__c, Port_No__c, Rack__c, Show_in_Customer_Portal__c FROM Interface__c where Name LIKE :p.Name];
if (thereIsNoDuplicates(records) == false) {
flagForTest = false;
}
toRemove++;
}
System.debug('Batch ends');
}
static Boolean thereIsNoDuplicates(List<Interface__c> records) {
// body of method
}
global void finish(Database.BatchableContext param1) {
}
global Database.QueryLocator start(Database.BatchableContext param1) {
String s = 'select Name, Total_No_of_Ports__c from Patch_Panel__c';
return Database.getQueryLocator(s);
}
}
system.debug
will not appear