function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jezza83Jezza83 

Can't set the Current Page in my Unit Test

Hi would really appreciate anyone's help with this one as I have gone over it a hundred times and am really stuck.

 

I can't work out why but Salesforce isn't letting me set the current page in my test method - I have done this a hundred times before and it is still in all the examples Salesforce give in their documentation but I am consistently getting a compile error: Method does not exist or incorrect signature: Test.setCurrentPage(System.PageReference)

 

 

 

@isTest

private class QuoteWizardControllerTest 
{

    public static testMethod void QuoteWizardController() 
    {
    	// Set the pageRef to Quote 1
    	PageReference pageRef = Page.quote1;
    	
    	//Instantiate and construct the controller class.   
        QuoteWizardController controller = new QuoteWizardController();

        // Set the current page
        Test.setCurrentPage(pageRef);
 
     }
}

 

I am using API v19 however I have tried going back a few versions but still no joy.

 

Any help would be greatly appreciated with this one.

 

Cheers Jeremy

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Jezza83Jezza83

Ok so I found another post with the exact same error here - http://community.salesforce.com/t5/Apex-Code-Development/Bug-in-test-setCurrentPage-method-does-not-exist/m-p/155100.

 

It seems that with the Winter 10 release you can no longer simply use test.method you now need to use system.test.method e.g.

 

 

system.Test.setCurrentPage(pageRef);

 

Would be great if Salesforce could update there examples and documentation :)