Appendix A:Mocking API Calls
API mocking is a process in which a mock server is configured to return the response of an API with custom data. API mocking plays a principal role in test automation development. It unblocks testing in situations where an external service might not be available or is too expensive to use for testing. Mocking also helps in cases where one of the APIs is still under development and there is a need to test a chain of API calls. A classic example where API mocking helps would be to unblock frontend testing by mocking certain unavailable backend API calls. Some of the most common API mocking tools and libraries include Jest, Postman, Cypress, JSON Server, and mocki.io.
In this appendix, we will be looking at the following:
- How API mocking works
- Mocking API calls using Postman
- Considerations for API mocking