Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Salesforce Certified Platform Developer II (PDII) · Salesforce
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
The answer is B. Answer A just moves the logic outside of the test class, but still runs the same amount of code. When you could do is use a TestDataFactory class marked with @IsTest and put that in the @TestSetup method, especially if more than one test class will be using the same data.
B as levian explained
Its B, because the problem is "many methods to create many records", if we use testSetup dont need to create many methods and the performance is increased. TestDataFactyory is used for reuse record creation in many classes, for example, create Account, Contact records, and reuse in many classes. But the question is not asking about reuse in other classes, so TestSetup its enough.