+ Start a Discussion
SFDC Apex DevSFDC Apex Dev 

Could anyone please help me to write the test class for the below webservice class??

//Generated by wsdl2apex

public class AsyncMWParts {
    public class cancelPartsRespFuture extends System.WebServiceCalloutFuture {
        public MWParts.cancelPartsResp getValue() {
            MWParts.cancelPartsResp response = (MWParts.cancelPartsResp)System.WebServiceCallout.endInvoke(this);
            return response;
        }
    }
    public class createPartsRespFuture extends System.WebServiceCalloutFuture {
        public MWParts.createPartsResp getValue() {
            MWParts.createPartsResp response = (MWParts.createPartsResp)System.WebServiceCallout.endInvoke(this);
            return response;
        }
    }
    public class AsyncSOAPOverHTTPs {
        public String endpoint_x = 'https://abc2b-dev.sales.com/Common/PurchaseOrder-2.0';
        public Map<String,String> inputHttpHeaders_x;
        public String clientCertName_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'https://abc2b.sales.com/Common/PurchaseOrder-2.0', 'MWParts'};
        public AsyncMWParts.cancelPartsRespFuture beginCancelParts(System.Continuation continuation,MWParts.RMAShipmentLine[] sObject_x) {
            MWParts.cancelPartsReq request_x = new MWParts.cancelPartsReq();
            request_x.sObject_x = sObject_x;
            return (AsyncMWParts.cancelPartsRespFuture) System.WebServiceCallout.beginInvoke(
              this,
              request_x,
              AsyncMWParts.cancelPartsRespFuture.class,
              continuation,
              new String[]{endpoint_x,
              'cancelPartsOrderAction2_0',
              'https://abc2b.sales.com/Common/PurchaseOrder-2.0',
              'cancelPartsReq',
              'https://abc2b.sales.com/Common/PurchaseOrder-2.0',
              'cancelPartsResp',
              'MWParts.cancelPartsResp'}
            );
        }
        public AsyncMWParts.createPartsRespFuture beginCreateParts(System.Continuation continuation,MWParts.RMAShipmentLine[] sObject_x) {
            MWParts.createPartsReq request_x = new MWParts.createPartsReq();
            request_x.sObject_x = sObject_x;
            return (AsyncMWParts.createPartsRespFuture) System.WebServiceCallout.beginInvoke(
              this,
              request_x,
              AsyncMWParts.createPartsRespFuture.class,
              continuation,
              new String[]{endpoint_x,
              'createPartsOrderAction2_0',
              'https://abc2b.sales.com/Common/PurchaseOrder-2.0',
              'createPartsReq',
              'https://abc2b.sales.com/Common/PurchaseOrder-2.0',
              'createPartsResp',
              'MWParts.createPartsResp'}
            );
        }
    }
}
Raj VakatiRaj Vakati
You need to create a mock response and need to pass it ti the test class
Please refer this link 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex_testing.htm

https://trailhead.salesforce.com/en/content/learn/modules/apex_integration_services/apex_integration_soap_callouts