Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

ExternalServiceTest Class

Provides methods to test an external service's asynchronous callouts, enables sending a mock request, asserts the expected request payload, then triggers the mocked external service’s asynchronous callback response.

Namespace

System

Usage

See Create Unit Testing for Asynchronous Callouts in the "Extend Salesforce with Clicks, Not Code" Help Guide.

ExternalServiceTest Methods

An instance of the ExternalServiceTest method is used when the test class triggers a mocked external service’s callback response. You can access ExternalServiceTest through Test.getExternalService()

The following are methods for ExternalServiceTest.

sendCallback(request)

Sends the HTTP request back as an external service asynchronous response.

Signature

public System.HttpResponse sendCallback(System.HttpRequest request)

1System.ExternalServiceTest, sendCallback, [System.HttpRequest], System.HttpResponse

Parameters

Return Value

Type: System.HttpResponse