What is the recommended way to test this functionality? if a - ProProfs Discuss
Cancel
TopicsDown
Products Down
Follow Us:
FacebookTwitter
Advertisement

What is the recommended way to test this functionality?
if a developer created a Visualforce page that has a custom controller that navigates to an external website after the command button is pressed.



A. Use .get URL on the result of the action method and System.assertEquals () to compare the resulting URL.
B. Use ApexPages.currentPage () .getUrl () and System.assertElquals () to compare the end URL.
C. Use Test.getCurrentPage() .getUrl () and System.assertEquals () to compare the end URL.
D. Test the navigation by executing the use case through the browser and manually inspecting the resulting URL.

This question is part of PD2-2
Asked by Pal, Last updated: Sep 13, 2020

+ Answer
Request
Question menu
Vote up 1 Vote down

4 Answers

M. Kennedy

M. Kennedy

M. Kennedy
M. Kennedy, Web Content Writer, Denver

Answered Oct 16, 2018

Many companies have websites and they want to have their information in Salesforce to connect to their website pages. It is important to have the websites accessed by as many people as possible, then it would be beneficial for exposure when people use a search engine to find something related to what the company is selling. If a developer created a page in Visualforce of the Salesforce program, then they may have a custom controller to navigate it to an external website which could be their own site or a backlink.

To access it, the command button can be pressed. The best recommended way to test to make sure this works is to get URLU on the rest of the action method and System.assert equals to compare the resulting URL.

upvote downvote
Reply 

devilzP

devilzP

devilzP
DevilzP

Answered Apr 05, 2018

A is right because you need to get the url from the Pagereference returned by the method.

upvote downvote
Reply 

rahul chandra

rahul chandra

rahul chandra
Rahul chandra

Answered Feb 21, 2018

No, A is right because you need to get the url from the Pagereference returned by the method.

upvote downvote
Reply 

Pal

Pal

Pal
Pal

Answered Nov 05, 2017

Use ApexPages.currentPage () .getUrl () and System.assertElquals () to compare the end URL.

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.