You need to sign in to do that
Don't have an account?
Sattibabu
How to write test method for the getContent() Method.
How to write test method for the below method:
"Methods defined as TestMethod do not support getContent call, test skipped"
How to cover getContent() method in test class. Anyhelp would be greatly appreciated.
public String getCaseURL() { return (new pagereference('/apex/MyVisualforcepage?id='+camp.id).getContent().toString()); }When i try to call this method in my test class. It's giving the following error.
"Methods defined as TestMethod do not support getContent call, test skipped"
How to cover getContent() method in test class. Anyhelp would be greatly appreciated.
All Answers
Best Regards
Naga Kiran
Try below solution and let me know if it helps you and mark the best answer.
public String getCaseURL()
{
String body;
try {
body=new pagereference('/apex/MyVisualforcepage?id='+camp.id).getContent().toString();
}catch (VisualforceException e) {
body = Blob.valueOf('Some Text');
}
return body;
}
Best Regards,
-Vivek
public String getCaseURL()
{
String body;
try {
body=new pagereference('/apex/TestVbd').getContent().toString();
}catch (VisualforceException e) {
body = String.valueOf('Some Text');
}
return body;
}
Best Regards,
-Vivek