Overview - Mock Data
- 28 Apr 2023
-
DarkLight
-
PDF
Overview - Mock Data
- Updated on 28 Apr 2023
-
DarkLight
-
PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
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.
Was this article helpful?