You need to sign in to do that
Don't have an account?
Anju Alexander 5
Test class for pagerefernce
Hi,
If I am writing a test class for a visualforce page whose controller returns a page refernce. How should I write and what all things should be kept in mind while writing the test class for pagereference?
If I am writing a test class for a visualforce page whose controller returns a page refernce. How should I write and what all things should be kept in mind while writing the test class for pagereference?
You write test class like this for page ref.
Mark this as best answer if its helps.
Thanks
Praveen Murugesan
All Answers
System.assert(controller.someMethod() != null);
You can also use PageReference class methods to assert the Page Name, query parameters etc.
Please refere the below links:
-
http://blog.shivanathd.com/2013/11/Best-Practices-Test-Class-in-Salesforce.html
-
https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods
Please mark as best answer if it solves your problem.Regards,
Grazitti Team,
www.grazitti.com
You write test class like this for page ref.
Mark this as best answer if its helps.
Thanks
Praveen Murugesan
I wrote the class. just for an example of pagereference in test class. Agree with you assert stmt should not be like this.
Thanks.
Thanks for helping.
Thanks and Regards,
Anju Alexander.
Thanks for giving the example of testing pageReference.
Thanks and Regards,
Anju Alexander.
Thanks for helping.
Thanks and Regards,
Anju Alexander.