Salesforce Platform Developer I (legacy) — Question 150

Which approach should be used to provide test data for a test class?

Answer options

Correct answer: C

Explanation

The correct answer is C because a test data factory class allows for consistent and reusable creation of test data, which is crucial for reliable testing. The other options, while possible, may lead to dependency on existing data (A), less controlled data creation (B), or limited accessibility (D), which can complicate testing and reduce reliability.