You need to sign in to do that
Don't have an account?

How do I test a public class that references a VF page?
I'm new to Apex and trying to achieve code coverage for an Apex Class that references a VF page. Below is my apex class:
public class Wave_Sales_Performance{ public PageReference saveMethod() { PageReference pgref = new PageReference('https://c.na26.visual.force.com/apex/Wave_Sales_Performance'); pgref.setRedirect(true); return pgref; } public PageReference saveMethod2() { PageReference pgref = new PageReference('https://c.na26.visual.force.com//apex/Wave_New_Rev_by_Individual'); pgref.setRedirect(true); return pgref; } public PageReference saveMethod3() { PageReference pgref = new PageReference('https://c.na26.visual.force.com/apex/Wave_YTD_Appointment_Metrics'); pgref.setRedirect(true); return pgref; } public PageReference saveMethod4() { PageReference pgref = new PageReference('https://c.na26.visual.force.com/apex/Wave_Online_Offline'); pgref.setRedirect(true); return pgref; } public PageReference saveMethod5() { PageReference pgref = new PageReference('https://c.na26.visual.force.com/apex/Wave_Actual_Budget'); pgref.setRedirect(true); return pgref; } }
Any solutions or advice would be much appreciated.
Thanks
Daniel
Refer this link:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm
Let us know if you have any issues.
Mark it as best answer if it works.
Thanks.
All Answers
Just like any other class.
1.Create instance.
Wave_Sales_Performance WSP=new Wave_Sales_Performance();
2.Call methods with instance.
WSP.saveMethod();
Let us know if you have any issues.
Mark it as best answer if it works.
Thanks.
Refer this link:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm
Let us know if you have any issues.
Mark it as best answer if it works.
Thanks.