Calling batch class from batch class. I have a issue in test class coverage where for the first batch class coverage below code is working fine.
Test.startTest(); BatchClass1 batch1 = new BatchClass1(arg1,arg2); Database.executeBatch(batch1,200); Test.stopTest();
But for the second batch class coverage below code is not working.
Test.startTest(); BatchClass2 batch2 = new BatchClass2(arg1,arg2); Database.executeBatch(batch2,200); Test.stopTest();
I changed in above code and now it's working fine. Below is the working code - objList is query list from start method.
BatchClass2 batch2 = new BatchClass2(arg1,arg2); Database.QueryLocator ql = batch2.start(null); batch2.execute(null,objList); batch2.Finish(null);
My question is - Why Database.BatchableContext BC is require NULL for successful test?