Salesforce Certified Platform Developer II — Question 255
What is a consideration when testing batch Apex? (Choose two.)
Answer options
- A. Test methods must execute the batch with a scope size of less than 200 records
- B. Test methods must call the batch execute() method once
- C. Test methods must use the @isTest (SeeAllData=true) annotation
- D. Test methods must run the batch between Test.startTest() and Test.stopTest()
Correct answer: A, D
Explanation
The correct answers, A and D, refer to the limitations and requirements for testing batch Apex in Salesforce. Option A is correct because Salesforce imposes a limit on the scope size for tests, while option D is right as it ensures that the asynchronous process is properly handled within the test context. Options B and C are incorrect because calling execute() multiple times is not restricted, and using @isTest (SeeAllData=true) is not a best practice for test methods.