You need to sign in to do that
Don't have an account?
JoshTonks
Test class help with save and redirect extension
I was hoping someone could help me. I have a controller extension which saves the record and then redirects the person away from the page. This is for our customers fo a customer feedback this all works for me but I have no idea how i would write a test class for the extension as I have done test classes for other things before but this I cannot get my head around any guidance would be much appreciated. This is my extension below im using www.google.com as a placeholder as I havn't got the page built just yet for the redirect.
public with sharing class CSATExtension { ApexPages.StandardController stdCtrl; // extension constructor public CSATExtension(ApexPages.StandardController std) { stdCtrl=std; } public PageReference save() { stdCtrl.save(); PageReference pr = new PageReference('http://www.google..com/'); pr.setRedirect(true); return pr; } }
I trust you are doing very well.
Below is the sample test class which I have tested in my org and it is working fine.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.
Thanks and Regards,
Khan Anas
All Answers
I trust you are doing very well.
Below is the sample test class which I have tested in my org and it is working fine.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.
Thanks and Regards,
Khan Anas