Part 1: Mock Microservices To Speedup Development
The microservices based architecture is an obvious choice for large applications in modern times. Such microservices are integrated in some fashion to achieve bigger business goal of the software. Automated tests play very important role for integration and acceptance testing while building such services.
In order to tests integrations, we generally mock external services for:
Running the tests faster
– Mocking services greatly improves productivity
– Mocking services helps developer wondering and loosing focus while running the tests
Substituting unavailable services
– Either the service is not written at all or
– It is down for some reason
Generally, developers tend to create a small web application(rails or sinatra) to simulate responses, error conditions, special cases etc. for the API. But there are difficulties in the approach when there are lots of business rules and large team.
Mocking such APIs makes life difficult to address the business rules and maintain the mock application the service. Also, Fronted and Mobile team might not know how to write server application to mock API.
We have distributed teams working of different microservices of a large content marketplace application. One team is working developing a custom REST API plugin in wordpress for marketplace and my team is developing consumer microservice for that service. Now, the wordpress team’s sprint is running behind time and we wanted to deliver our sprints on time.
We had a clear spec for the REST APIs and so we decided to go and start application to mock the wordpress service to keep sprints running. We have decided not to write rails/sinatra apps to mock APIs. Luckily we have got an opensource mock server Montebank built by ThoughtWorks.
Montebank is an open source tool to provide cross-platform, multi-protocol test doubles over the wire.
In Part 2 of this story, I will demonstrate how we can easily configure mock server and mostly not writing any code.
At BoTree Technologies, we build web and mobile applications to add value to our client’s business. We align ourselves to ensure that our client benefits the most out of our engagement.
Drop us a line to discuss how can we help take your business to the next level.
Choose Your Language
- Digital Marketing
- IT Consulting
- Project Management