QuestionQ120

VerifiedSalesforce Integration Testing

Northern Trail Outfitters (NTO) wants to improve the quality of callouts from Salesforce to its REST APIs. To do so, NTO will require every API client/consumer to follow REST API Markup Language (RAML) specifications that include field-level definitions for every API request and response payload. The RAML specifications act as interface contracts that Apex REST API Clients can depend on.

Which design specification should the integration architect include in the integration architecture so that Apex REST API Client unit tests verify adherence to the RAML specifications?

Explanation

Apex HTTP-callout tests use an HttpCalloutMock configured by Test.setMock, and the test invokes the Apex REST API client to receive the mock response. A mock response shaped according to the RAML contract lets the test verify that the client correctly handles the specified payload. Production client code does not implement or directly invoke HttpCalloutMock.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!