Imagine that you’re a developer working for a tech organization that uses a microservice architecture. Your team is responsible for the microservice that retrieves user data from a cluster of user databases located on the back-end. In order to make these requests, however, you depend on another microservice maintained by another team to provide you with a list of users. Your team is ready to start testing your next version, but the user team hasn’t even begun to develop theirs. How can you test your service when they’re not providing you with data?
API Mocking is a process that simulates the behavior of an API endpoint. Instead of instantiating a new server to simulate the behavior of the missing API, mocking allows a user to define a route and response. Once active, this route will serve the preconfigured response for as long as the mock API is active. In the previous example case, the developers behind the microservice could have deployed a mock API of the missing API and continued development on their own service.
Mocking is a versatile tool. There are multiple scenarios in which it solves a major problem that developers face on a regular basis. Imagine a developer who relies on external data from a public API. The development environment that this developer works in is firewalled and cannot access the internet at large. This developer needs specific data from the Google Maps API to demonstrate that their code is working, but because of the internal nature of the development environment, cannot access the API. By setting up a mock version of the Google Maps API, the developer can continue working without exposing the development environment to an unsafe connection with the outside world.
Mocking with API Fortress is easy to use and robust in terms of functionality. When defining a mock endpoint, the user is presented with a number of options that will provide them with the exact behavior they are trying to simulate. When creating an endpoint, a user will define the endpoint route, the REST verb being used (GET, POST, etc.), the status code returned and the response body itself. Once the endpoint is configured and saved, it can be accessed from anywhere. An entire simulated API service can be stood up with ease and accessed from anywhere with API Fortress mocking.
API Fortress makes automated API endpoint testing accessible for people of all levels of technical expertise. From tester to developer, API Fortress’ robust feature set and accessible graphical user interface allow anyone to stand up a meaningful and functional API test in minutes. After setting up the test, API Fortress allows the user to schedule it to occur regularly and export the results to a number of other platforms. With the addition of mocking, API Fortress now allows users to create mock API endpoints. Mock endpoints can be accessed from outside the platform. They can even be accessed through a standard web browser. If a test depends on external data that is for any reason unavailable, API Fortress can emulate the source of this data, allowing the test to continue unimpeded.
Visit our YouTube page to watch an overview of API Fortress.