nerdexam
Salesforce

PDI · Question #206

While working in a sandbox, an Apex test fails when run in the Test Runner. However, executing the Apex logic in the Execute Anonymous window succeeds with no exceptions or errors. Why did the method

Sign in or unlock PDI to reveal the answer and full explanation for question #206. The question stem and answer options stay visible for context.

Submitted by saadiq_pk· Apr 18, 2026Testing, Debugging, and Deployment

Question

While working in a sandbox, an Apex test fails when run in the Test Runner. However, executing the Apex logic in the Execute Anonymous window succeeds with no exceptions or errors. Why did the method fail in the sandbox test framework but succeed in the Developer Console?

Options

  • AThe test method has a syntax error In the code.
  • BThe test method does not use System. rurAs to execute as a specific user.
  • CThe test method Is calling an future method.
  • DThe test method relies on existing data in the sandbox.

Unlock PDI to see the answer

You've previewed enough free PDI questions. Unlock PDI for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#Apex Testing#Test Data Isolation#Execute Anonymous#Sandbox Data
Full PDI Practice