Salesforce
CRT-450 · 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…
The correct answer is D. The test method relies on existing data in the sandbox. See the full explanation below for the reasoning.
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.
How the community answered
(30 responses)- A3% (1)
- B7% (2)
- C13% (4)
- D77% (23)
Community Discussion
No community discussion yet for this question.