Getting started with mock servers
Mock servers are a powerful tool to have in your API testing toolbelt. We will start with a look at what they are, when to use them, and also, importantly, when it doesn’t make sense to use them.
What is a mock server?
Obviously, in this book, when we talk about a mock server, we talk about a server that mocks an API. In this context, a mock server is simply a server that mocks out the real implementation of the API. In a way, it creates an alternative implementation. Instead of using real API code, we can create our own implementation that returns data. Calling it an implementation is almost saying too much though.
The reality is that most mock API servers do not do much code implementation. Usually, it is just a set of hardcoded responses that are returned when you call certain endpoints, but the point is that you get back those responses rather than the ones computed by the main server.
A mock server can be very simple....