Overview - Mock Data
  • 28 Apr 2023
  • Dark
    Light
  • PDF

Overview - Mock Data

  • Dark
    Light
  • PDF

Article summary

Mock data represents the data the external system will return on an API call. This data is stored in the adapter so that the adapter can use it to respond to API calls when running in ”stub” mode. This means the adapter is not going to make the actual call to the other system. Instead, it will go through the entire process, but when it makes the call, it will return the mock data instead.

  • Mock data can be captured in different ways.
    • Adapter Builder will extract it from OpenAPI if the responses are in the OpenAPI documentation.
    • Data can be captured using Postman - just copy the response and put it into a mock data file.
    • When you run integration tests on the adapter you can tell it to save the mock data
    • You can retreive responses from the adapter logs, if logging at the debug level, and put that into a mock data file.
  • With mock data you can test the entire adapter (not just adapter.js) in standalone mode using the built-in integration tests that come with the adapter. These tests will run through the adapter and the adapter libraries up to the point where the API call is made, and then instead of making the call, the mock data will be returned. This capability allows you to test the full flow of data through the adapter - including translation.
  • What mock data cannot test is true authentication; if the URL is correct, that means the request data is accurate or that the response is the most up-to-date response (if you capture the mock data, then it should be accurate or up-to-date). Mock data is also not maintained. So, as things change, your mock data may need to be updated.

Running an Adapter in Stub Mode

This workflow displays the process the adapter follows when running in stub mode. As noted above, this process allows you to test the flow of data through an adapter without making an actual call.

Adapter_Stub_Flowchart 1


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.