You need to sign in to do that
Don't have an account?
TestMethod do not support service callouts
the error is : Methods defined as TestMethods do not support Web service callouts, test skipped
//Generated by wsdl2apex
global class localhostSoap {
public class Root_PortType {
public String endpoint_x = 'http://localhost/soap/';
private String[] ns_map_type_info = new String[]{'http://localhost/soap/types', 'localhostSoapTypes', 'http://localhost/soap/', 'localhostSoap'};
public Integer deleteTable(String server_name,Integer port,String table_name) {
localhostSoapTypes.deleteTable_element request_x = new localhostSoapTypes.deleteTable_element();
localhostSoapTypes.deleteTableResponse_element response_x;
request_x.server_name = server_name;
request_x.port = port;
request_x.table_name = table_name;
Map<String, localhostSoapTypes.deleteTableResponse_element> response_map_x = new Map<String, localhostSoapTypes.deleteTableResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'deleteTable',
'http://localhost/soap/types',
'deleteTable',
'http://localhost/soap/types',
'deleteTableResponse',
'localhostSoapTypes.deleteTableResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.result;
}
// other methods here
// added test method
public static testMethod void testdeleteTable(){
localhostSoap lhsoap = new localhostSoap();
localhostSoap.Root_PortType rport = new localhostSoap.Root_PortType();
System.assertEquals(0, rport.deleteTable('localhost',3579,'test') );
}
}
What i am doing wrong here?
thank you very much
but I can't deploy this code...
any suggestion please? thank you
a warning. There should be someother reason for not deploying.
I am deploying from Eclipse, when I run test cases it is a warning, but the deployment fails because of that, there is no other error (test coverage is 83 %).
I'll submit print screen tomorrow
how can I deploy that? - thank you very much for your time
You can avoid making the callout from test (just comment out the callout part)
and you will be able to deploy.
Please, use this in your test method and all will be resolved....
Here is the link to the implementation this uses:
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
Here is the section that covers this in general:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_http_testing.htm
May The SForce Be With You!
Nathan Pepper
youtube.com/MayTheSForceBWithYou
@SForceBeWithYou