You need to sign in to do that
Don't have an account?
How to cover the code coverage??
I have a very less idea of how to make the code coverage.So could anybody guide me through it once so that i get some idea.
This class is used as an extension in a VF page. I am fetching the ID of a record and then navigating to different page on a button click passing that retrieved ID in the next page URL.
public class PortExt
{
String currentportfolioId;
public PortExt(ApexPages.StandardController controller)
{
currentportfolioId=ApexPages.currentPage().getParameters().get('id');
}
public Pagereference testRedirect()
{
Pagereference p=new Pagereference('/apex/saveportfolio?id='+ currentportfolioId);
p.setredirect(true);
return p;
}
}
Hi,
It may help you, You should write below code with in the testmethod.
PortExt test1 = new PortExt();
Apexpages.currentpage().getparameters().put('id','id_value_here');
test1. testRedirect();