This error occurs because webService callouts is not allowed in Test class.
To bypass callouts add HttpcalloutMock class.
Here is Sample test class with mock class to bypass webservice Callout.
********************** Test Class ***************************
@isTest
private class Test_class {
private class RestMock implements HttpCalloutMock {
public HTTPResponse respond(HTTPRequest req) {
String fullJson = 'your Json Response';
HTTPResponse res = new HTTPResponse();
res.setHeader('Content-Type', 'text/json');
res.setBody(fullJson);
res.setStatusCode(200);
return res;
}
}
static testMethod void service_call() {
Test.setMock(HttpCalloutMock.class, new RestMock());
Test.startTest();
//your webserive call code
Test.StopTest();
}
}
Mock class will take care webservice callouts.