What is the recommended way to test this functionality? if a - ProProfs Discuss
Topics-
Products +
     

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: Nov 19, 2019

+ AnswerRequest Answer
1
...

4 Answers

M. Kennedy

M. KennedyWeb Content Writer, Denver
Web Content Writer, Denver

Answered on 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.

 Reply

devilzP

DevilzP

Answered on Apr 05, 2018

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

 Reply

rahul chandra

Rahul chandra

Answered on Feb 21, 2018

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

 Reply

Pal

Pal

Answered on Nov 05, 2017

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

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

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