Salesforce
CRT-450 · Question #43
A developer observes that an Apex test method fails in the Sandbox. To identify the issue, the developer copies the code inside the test method and executes it via the Execute Anonymous tool in the…
The correct answer is B. The test method relies on existing data in the sandbox. See the full explanation below for the reasoning.
Question
A developer observes that an Apex test method fails in the Sandbox. To identify the issue, the developer copies the code inside the test method and executes it via the Execute Anonymous tool in the Developer Console. The code then executes with no exceptions or errors. Why did the test method fail in the sandbox and pass in the Developer Console?
Options
- AThe test method has a syntax error in the code.
- BThe test method relies on existing data in the sandbox.
- CThe test method is calling an @future method.
- DThe test method does not use System.runAs to execute as a specific user.
How the community answered
(57 responses)- A18% (10)
- B70% (40)
- C4% (2)
- D9% (5)
Community Discussion
No community discussion yet for this question.