You need to sign in to do that
Don't have an account?
Need help for test class coverage
Hello experts,
I've to increase test class code coverage, but I'm new to salesforce and not able to figure out the solution, please help me for the below method.
I've several method but need to know any one so that I can debug with remaining classes. Here I'm getting red line i.e. not covered in test is marked in bold.
please guide me how can I pass the value to the method, what should be my approach and best practice in industry. This method is called from constructor and it is not parameterised. please guide a test class for this.
public void initializeRollouts()
{
searchCountry=null;
isNoResult=false;
projectId = ApexPages.currentPage().getParameters().get(IPM_ConstantUtils.SF_ID);
if (projectId != null)
{
isEditable = IPM_Utils.getIPMRollOutUser(projectId);
if(!isEditable)
{
errorMessage = String.valueOf(new ApexPages.message(ApexPages.severity.INFO,Label.IPM_PLEASE_CONTACT_ADMINISTRATOR));
}
getUnileverCountries();
generateWrappers();
generateSubWrappers();
}
}
I've to increase test class code coverage, but I'm new to salesforce and not able to figure out the solution, please help me for the below method.
I've several method but need to know any one so that I can debug with remaining classes. Here I'm getting red line i.e. not covered in test is marked in bold.
please guide me how can I pass the value to the method, what should be my approach and best practice in industry. This method is called from constructor and it is not parameterised. please guide a test class for this.
public void initializeRollouts()
{
searchCountry=null;
isNoResult=false;
projectId = ApexPages.currentPage().getParameters().get(IPM_ConstantUtils.SF_ID);
if (projectId != null)
{
isEditable = IPM_Utils.getIPMRollOutUser(projectId);
if(!isEditable)
{
errorMessage = String.valueOf(new ApexPages.message(ApexPages.severity.INFO,Label.IPM_PLEASE_CONTACT_ADMINISTRATOR));
}
getUnileverCountries();
generateWrappers();
generateSubWrappers();
}
}
pagereference pageref = page.PageName;
Test.SetCurrentPageReference(pageref);
pageref.getParameters().put('projectId', IPM_ConstantUtils.SF_ID); //pass valid IPM_ConstantUtils.SF_ID