SF-PD2 Testing, Debugging, and Deployment • Set 3
SF-PD2 Testing, Debugging, and Deployment Practice Test 3 — 15 questions with explanations. Free, no signup.
A developer writes a test class for an Apex service that enforces a custom validation rule: an Account cannot be saved without a ShippingPostalCode. The test method creates an Account, inserts it with a valid postal code, then attempts to update it to a blank postal code inside a try-catch block using Test.startTest() and Test.stopTest(). The test passes locally but fails in the production deployment validation step with 'System.DmlException: Insert failed'. Which approach should the developer use to make the test reliable across all environments?
Choose an answer to begin — your selection is scored in the full session.
15 questions · instant feedback and full explanations after every question.