Salesforce Platform Developer I (legacy) — Question 159
A developer created a trigger on the Account object and wants to test if the trigger is properly bulkified. The developer team decided that the trigger should be tested with 200 account records with unique names.
What two things should be done to create the test data within the unit test with the least amount of code? (Choose two.)
Answer options
- A. Use the @isTest(seeAllData=true) annotation in the test class.
- B. Create a static resource containing test data.
- C. Use the @isTest(isParallel=true) annotation in the test class.
- D. Use Test.loadData to populate data in your test methods.
Correct answer: B, D
Explanation
Option B is correct because creating a static resource allows for easy management and reuse of test data while keeping the code minimal. Option D is also correct as Test.loadData provides a straightforward way to load bulk test data into the test methods. Options A and C are not ideal for this scenario as they relate to testing with existing data or parallel execution, which does not address the need for generating unique account records.