Skip to main content
added 33 characters in body
Source Link
Ratan Paul
  • 22.8k
  • 14
  • 55
  • 99

I have a method like page reference method in my class.How How to cover the pagereference method in test class??? all the other methods were covered except the pagereference method.

I tried like:

PageReference pageRef = Page.myclassname; Test.setCurrentPage(pageRef); pageRef.getParameters().put('timezonevar',var);

PageReference pageRef = Page.myclassname;
Test.setCurrentPage(pageRef);
pageRef.getParameters().put('timezonevar',var);

but of no use;

my methods is like:

public PageReference mymethod(){

here using some variables which are used in the standard controller constructor....

all the logic goes here,

return null; }

public PageReference  mymethod(){

//here using some variables which are used in the standard controller constructor....

//all the logic goes here,

return null;
}

I have a method like page reference method in my class.How to cover the pagereference method in test class??? all the other methods were covered except the pagereference method.

I tried like:

PageReference pageRef = Page.myclassname; Test.setCurrentPage(pageRef); pageRef.getParameters().put('timezonevar',var);

but of no use;

my methods is like:

public PageReference mymethod(){

here using some variables which are used in the standard controller constructor....

all the logic goes here,

return null; }

I have a method like page reference method in my class. How to cover the pagereference method in test class??? all the other methods were covered except the pagereference method.

I tried like:

PageReference pageRef = Page.myclassname;
Test.setCurrentPage(pageRef);
pageRef.getParameters().put('timezonevar',var);

but of no use;

my methods is like:

public PageReference  mymethod(){

//here using some variables which are used in the standard controller constructor....

//all the logic goes here,

return null;
}
Source Link
Dileep
  • 33
  • 2
  • 7

How to cover pagereference method in test class

I have a method like page reference method in my class.How to cover the pagereference method in test class??? all the other methods were covered except the pagereference method.

I tried like:

PageReference pageRef = Page.myclassname; Test.setCurrentPage(pageRef); pageRef.getParameters().put('timezonevar',var);

but of no use;

my methods is like:

public PageReference mymethod(){

here using some variables which are used in the standard controller constructor....

all the logic goes here,

return null; }