exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 71 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 71
Topic #: 1
[All Certified Platform Developer II Questions]

What is a best practice when unit testing a controller? (Choose two.)

  • A. Simulate user interaction by leveraging Test.setMock()
  • B. Verify correct references by using getURL()
  • C. Access test data by using seeAllData=true
  • D. Set query parameters by using getParameters().put
Show Suggested Answer Hide Answer
Suggested Answer: BD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
vancika
1 month ago
Selected Answer: AD
A. Simulate user interaction by leveraging Test.setMock() If the controller interacts with external systems or APIs, using Test.setMock() is a best practice to simulate responses during testing. This ensures tests are isolated and do not depend on external systems. D. Set query parameters by using getParameters().put The example provided demonstrates setting query parameters (e.g., error parameters for the "Failure" page) using getParameters().put. This is essential when testing controllers where page logic depends on query parameters.
upvoted 1 times
...
lorenac2
10 months, 1 week ago
Selected Answer: BD
Overview: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_error_handling.htm
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago