You need to sign in to do that
Don't have an account?
Arun_Pali
Compilation error..
Hello friends,
I get an error while trying to compile the test coverage classes.
Error: Compile Error: Method does not exist or incorrect signature: Test.setCurrentPage(System.PageReference) at line 39 column 9
This error starts occuring only after I created a managed package for my app. Any idea friends ?
Below is my code :
PageReference pageRef = Page.testpage1;
Test.setCurrentPage(pageRef);
Any hints would be helpful !!
Thanks.
I get an error while trying to compile the test coverage classes.
Error: Compile Error: Method does not exist or incorrect signature: Test.setCurrentPage(System.PageReference) at line 39 column 9
This error starts occuring only after I created a managed package for my app. Any idea friends ?
Below is my code :
PageReference pageRef = Page.testpage1;
Test.setCurrentPage(pageRef);
Any hints would be helpful !!
Thanks.
Make sure your test method starts this way:
Also Call setCurrentPageReference instead of SetCurrentPage.
I have posted on article on this blog on how to get a good test coverage on your visualforce pages.
http://salesforcesource.blogspot.com/2008/09/geting-good-test-coverage-on-vf-pages.html
http://salesforcesource.blogspot.com/2008/09/geting-good-test-coverage-on-vf-pages.html
Salesforce developer wiki also have very good examples.
Good luck,
By anychance do you know whether is it good to have 2 test classes for a single controller class. The reason being, my controller class is 700 lines long and contains lots of conditions. When I tried to write test methods for all the conditions, the test class became very huge and hence throwed an error saying that the class is huge. So now I plan to split the test methods between 2 different classes. Is this a good practise ? Is there any other alternative you would suggest ?
Thanks.
You may also want to divide your heavy visualforce page into smaller components (some that might be reusable later on) and then have separate classes to test the components out.
Having the code divided into smaller pieces (Components) makes all more manageable later on when you want to support/troubleshoot or improve (add/remove feature) your page.
Cheers,
Sam
My controller is just 600 odd lines (which is quite normal I guess) , but it has lots of conditions (if..else..) .. so thats the reason my test class is going beyound 2000 lines .. and my visual force page is also quite small.