+ Start a Discussion
ran67ran67 

Testcase code coverage

hi i have  wrote an controller 

actuall in my controller these method is not covered

Public void deltsheet()
{
String rownumber = System.currentPagereference().getParameters().get('rownumber');
Decimal rownumb = Decimal.Valueof(rownumber);
Integer rowno = rownumb.IntValue();
String tentryid = System.currentPagereference().getParameters().get('tentryid');
if (rownumber != '')
tentries.remove(rowno);

}

 

how to declare the above method in my testcase so that my coveragemay increase actuall how to declare rownumber

tentryid

in my testcase so that my coverage may increase

 

thanks in advance

 

 

 

Navatar_DbSupNavatar_DbSup

Hi,

 

Just call the method in your test method.

Try the below code snippet as reference:

Class_name1 obj1=new Class_name1();

Obj1. Deltsheet();

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

ran67ran67

I have declare already bt its was not covered in  that method 

I have declared has

String rownumber = System.currentPagereference().getParameters().get('rownumber');

how to declare in testcase

thanks in advance


mohimohi

Use this line before calling the method : System.currentPagereference().getParameters().put('rownumber', value);

then call method.