+ Start a Discussion

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)





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


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) 

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.





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