+ Start a Discussion

Testing loading a page

How does one test loading an opportunity record page?

There is an action that fires when the opportunity page is loaded (via a visualforce page).  I know the controller extension and action work because its been proven via the UI.  Just not sure to how properly write a unit test to load the page, and thus trigger the action to run.
Sujith NairSujith Nair
Take a look at the below documentation on how to test extensions/visualforce pages.
I don't see any documentation on how to invoke an action in a unit test.

Visualforce Page:
<apex:page standardController="Opportunity" extensions="numOpptyContactRoles" action="{!rollupOppContacts}" />

Turns out it was as simple as invoking the method like normal.  For some reason I thought this was done differently.  But this worked fine.

Jason Kuzmak 12Jason Kuzmak 12

Glad you figured it out. Was just scratching my head over this myself.