nerdexam
Salesforce

PDII · Question #15

A company has many different unit test methods that create Account records as part of their data setup. A new required field was added to the Account and now all of the unit tests fail. What is the…

The correct answer is B. Create a TestDataFactory class that serves as the single place to create Accounts for unit tests. See the full explanation below for the reasoning.

Question

A company has many different unit test methods that create Account records as part of their data setup. A new required field was added to the Account and now all of the unit tests fail. What is the optimal way for a developer to fix the issue?

Options

  • AAdd a before insert trigger on Account to set the value of the required field.
  • BCreate a TestDataFactory class that serves as the single place to create Accounts for unit tests
  • CChange the required field to be a validation rule that excludes the System Administrator profile.
  • DAdd the required field to the data setup for all of the unit tests.

How the community answered

(32 responses)
  • A
    13% (4)
  • B
    78% (25)
  • C
    3% (1)
  • D
    6% (2)

Community Discussion

No community discussion yet for this question.

Full PDII Practice