Salesforce Certified Platform Developer II — Question 139
A developer wrote a Visualforce page for Sales Reps to add products to an order. The page takes a URL query parameter, productFamily, which filters the product results. The test method for the filter behavior has an assertion failing due to an incorrect number of results.
Why could the test be failing? (Choose two.)
Answer options
- A. The test does not call Test.startTest()
- B. The test does not create product data
- C. The test is not run by a System Administrator
- D. The test does not set the current page reference
Correct answer: B, D
Explanation
The correct answer includes B and D because the test needs to create the necessary product data to filter correctly (B) and must set the current page reference to ensure the URL parameters are recognized (D). Options A and C are irrelevant as they do not directly affect the filtering mechanism of the Visualforce page in this scenario.