function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vikas rathi91vikas rathi91 

Test Class For callout to API

I am New in salesforce want to know how to write the test class for the call out class 

public with sharing class XeroCalloutUtility {
   
    public static Xero_Settings__c xeroSettings {

        get {

            if (xeroSettings == null) {
                
                xeroSettings = Xero_Settings__c.getInstance('Xero');
               
            }
            return xeroSettings;
        }
        set;
    }
    
    
    
    public static HttpResponse executeCallout (String method, String resourceName, String requestBody) {

        system.debug('>>>>>>>>>>xeroSettings '+xeroSettings);
        HttpRequest request = new HttpRequest();    
        request.setMethod(method);
        request.setEndpoint(xeroSettings.Endpoint__c + resourceName);
        request.setHeader('Accept', 'application/json');
        system.debug('>>>>>>>>>>>>>>>>>>request '+request);
       
        if (String.isNotBlank(requestBody)) {
            request.setBody(requestBody);           
            request.setHeader('Content-Type', 'text/xml');
        }

       
        request = XeroOAuthUtility.signRequest(request, xeroSettings.Consumer_Key__c);        
        return new Http().send(request);
    }

}

I am try but not Success code coverage 0% 
Lokeswara ReddyLokeswara Reddy
Please refer the link
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex_testing.htm