API Simulator for Microservices testing

SivaKumar
Nov 8, 2020

In this article i will be writing about using API simulator for microservices testing. We will build one sample API simulator using Node.js.

Problem : In Microservices architecture based applications one application/service interact with multiple services very often. So everytime the dependent applications/services should be up and available for other applications for development/testing activities. So instead of connecting to actual services ,we can connect to the dummy service(simulator) which acts as same as original application and perform the tasks dependent on that particular service.

Solution : We can build a API simulator which works as same as original application. And then we can run the applications against this simulator and perform the tasks.

Example : So for example we need to connect to the account_details service in our application (front end application or other application), at this time the account_details service is not available or not yet ready. In these cases the front end application team can not wait for completion of the service or to bring it up every time it goes down because of its inconsistency. So if we use API simulator for these problems , we dont need to dependent on the account_details service team for any work.

There are many API simulation / service virtualisation tools available. For more details check here. In this article we will be developing our own simple API simulator using Node.js and improve it over the time.

Please have a look in the below picture on how API simulator can be used.

--

--