You need to sign in to do that
Don't have an account?
.Net Api
Query string is not covered in code coverage ?
Hi ,
I am using a method which gets the query string and the red marked line is not covered in the code coverage ,please let me know how to solve this issue and why it is not covered in the code coverage waiting for the immediate response .
Below is the code snippet
public Integer getPageNumber()
{
String count;
if ( ApexPages.currentPage().getParameters().get('page') != null)
{
count=ApexPages.currentPage().getParameters().get('page');
}
Integer iPageNumber=Integer.ValueOf(count);
return iPageNumber;
}
Regards,
vasu
u have to wrtite this before calling getPageNumber method
ApexPages.currentPage().getParameters().put('page', appropriatevalue);
Dear kiran ,
In code coverage it is showing still in red color only ,the below highlighted red color is not covering in the code coverage .
public Integer getPageNumber()
{
String count;
if ( ApexPages.currentPage().getParameters().get('page') != null)
{
ApexPages.currentPage().getParameters().Put('page',count);
}
Integer iPageNumber=Integer.ValueOf(count);
return iPageNumber;
}
Regards,
Vasu
post me your test code
Could you please share your test method.
Are you using Test..setCurrentPageReference() to specify the page being tested? If so, have you tried setting the parameters on that page reference before running the test code?