March 13, 2017

Batch class execute() method not covered by test class

1. Remember that the execute method will be called only once.

2. If you have chained batch classes, create separate methods for each and every batch class.

3. Make sure the start method fetches the required to process in execute method.


  1. I have created a test class for batch class. Query is returning records in StartMethod. But Execute method is not even covering single line

    1. Hi, definitely the execute() will be called if the start() fetched the data. Add debug statements and make sure SOQL fetched data.