Salesforce
PDII · Question #40
A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow. What can a developer to do address the issue?
The correct answer is B. Move the prerequisite reference data setup to a @testSetup method in the test class. See the full explanation below for the reasoning.
Question
A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow. What can a developer to do address the issue?
Options
- AMove the prerequisite reference data setup to a TestDataFactory and call that from each test
- BMove the prerequisite reference data setup to a @testSetup method in the test class.
- CMove the prerequisite reference data setup to a static method in the test class and call that from
- DMove the prerequisite reference data setup to the constructor for the test class.
How the community answered
(43 responses)- A5% (2)
- B84% (36)
- C9% (4)
- D2% (1)
Community Discussion
No community discussion yet for this question.