You need to sign in to do that
Don't have an account?
Dipika
test webservice api callouts
hello,
I m using google service class for authenticating user on my page. but i m using direct google service class methods. so when i m creating test class it is giving error of webservice callout. so is there any way to use google service class and also test that class in which i m using this??
You cant not invoke a web service in your test class.Try to skip that line by using some boolean variable.It is such a hack like this>
Public class WebSrvcClass
{
public boolean Istest{get;set;}
public WebSrvcClass()
{
Istest=false;
}
public void urwebservicemethod()
{
.........
if(!Istest)
HttpREquest.send(.....);
}
private static void testmethod urmethod()
{
public WebSrvcClass class=new WebSrvcClass();
class.isTest=true;
}
}
We have system static method to do this so we dont need a seperate variable to do this.
So modified class should be like:
BTW you can create a fake request in your class and try calling a method which accepts required parameters for HttpRequest. You should use this method in your main class as well to send HTTP request.
Regards,
Lakshman