You need to sign in to do that
Don't have an account?
ForceCom
Custom Controller Test Class
Hi
I am facing an issue in writing an test method for the custom controller.
I am not able to capture the page parameters, in the test class.Please find below the code.
/*
public class multirecords{
public List<Registration__c> regs {get; set;}
public Semester_Schedule__c academic {get; set;}
Id id = ApexPages.currentPage().getParameters().get('id');
public multirecords(){
academic=[Select Id, Name from Semester_Schedule__c where Id=:Id];
regs = new List<Registration__c>();
regs.add(new Registration__c(Semester_Schedule__c=academic.Id));
}
public void addrow(){
regs.add(new Registration__c(Semester_Schedule__c=academic.Id));
}
public PageReference save(){
insert regs;
PageReference home = new PageReference('/home/home.jsp');
home.setRedirect(true);
return home;
}
}
*/
any kind of help, guidance, is truly appreciated.
Thanks All
In your test method you need to set the page parameters like this:
Also, pretty sure you can't give a variable the name of "id":