No More Chasing Shadows: Use API Mocking to optimize Dev & Test
Introduction to API Mocking
Multiple industries use mock ups, models, simulators, and trial assemblies to improve the reliability, quality, and integrity of their finished products.
A mock testing and simulation environment for APIs provides equivalent benefits for applications developers.
A good API mocking solution increases developer productivity by helping to divide up the work. API mocking simulates the interface contract even though one or more APIs may not be available or completed, allowing development work to proceed against the mocked API even when one or more of the real APIs aren’t available.
Furthermore, agreeing on an API specification early in the lifecycle process frees dev teams to work on their portion of the application in parallel with teams working on other parts of the application.
Other industries refer to such independent, parallel work as a “division of labor” and broadly adopt the practice for its productivity and time to market benefits.
The Growing Need for API Mocking
The world is increasingly going digital, depending on more and more APIs to power applications. The digital disruptors such as Amazon, Uber, Google, Air BnB, Netflix, and Facebook, to name a few, all use APIs to help deliver an exceptional customer experience.
Take for example mobile applications. Anyone else's mobile application will be compared to the standard set by the digital disruptors. Customers expect a seamless and intuitive UI that’s always there and working whenever they pick up their phones. They expect a fast response with any search and expect any data they input to be processed quickly and efficiently, without ever losing a message.
Such great customer experiences aren’t delivered in isolation. Great digital applications depend on responsive third-party and internal APIs to back end microservices to send and receive the data users interact with.
Using Uber as an industry leading example, they use third party APIs for Google Maps that show the location of the Uber car and chart progress throughout the journey.
They also use third party APIs to accept and process credit card payments seamlessly and automatically. And finally, they develop their own internal APIs to back end microservices for scheduling rides, handling tips, and collecting ratings.
All of these APIs have to work together smoothly and seamlessly and integrate correctly with the mobile app so that any action on the user interface immediately and seamlessly interacts with the back end services. .
API mocking tools help create applications such as Uber’s by providing a realistic and active server you can invoke during development to simulate the response to API calls, even when the API implementations aren’t available, and let you know whether the application is working correctly and reliably with the APIs
Improving Productivity with API Mocking
When developing applications you typically want front-end experts working on the interactivity of the apps and microservices experts working on the scalability of the server side.
Code from the front-end and back-end microservices teams are typically combined to deliver the customer experience. The handoff points between them – and the way in which they are connected – is typically determined by the set of APIs provided by the back end microservices. If any third party APIs are in scope, those need to be included as well.
Jumia is an example of a global ecommerce shopping site similar to Amazon, based in South Africa. They are a “mobile first” organization, i.e. they develop new application capabilities first for mobile devices and then later for the website.
They found themselves losing a lot of time in getting new capabilities into production. The front-end teams would design the new capabilities and the new APIs (or changes to existing APIs) that they needed, and tell the backend microservices team what they needed them to do. This would take about a week.
It would take the back end team another two weeks to deliver code for the front-end team to test. On top of that it took more time to stand up the test environment, keep it running, and deploy and update the new code for testing.
Altogether this took about three weeks until they could get started with their application development and testing on top of the delivered API. And like most ecommerce sites, there’s a lot of pressure from the market and customers to get updates and improvements into production as quickly as possible.
Jumia decided to use an API mocking solution to reduce time between dev and test, choosing WireMock Cloud. This cut the development time for new features by three weeks by allowing the FE and BE teams to work in parallel, dividing up the labor.
WireMock Cloud provided Jumia with an always-on API bridge between the teams, instead of relying on their internal staging and integration environments to set it up and maintain it.
WireMock also helps Jumia manage changes to software code to ensure that teams can validate new functionalities on the correct code deployments as quickly as possible.
The Intellyx Take
Developing mobile apps or any front-end application that depends on multiple internal and third party APIs can be challenging, especially when combining all of these various APIs.
Getting all this working correctly quickly is the way in which you deliver great digital experiences to your customers, and continuously improve them. And you want to achieve this all as reliably as possible.
Development teams work more productively when they can work independently and in parallel. Amazon and other digital pioneers are well known for establishing the API as a contract agreed between two (or more teams) to enable such parallel development.
Setting up an API mocking server early in the development process is a great way to increase productivity, lower cost, and improve overall results. That’s where API mocking tools such as WireMock Cloud can help.
Copyright © Intellyx BV. Intellyx is solely responsible for the content of this article. As of the time of writing, WireMock Cloud is an Intellyx customer. No AI chatbots were used to write this content. Image by Brianwcallaghan, via Wikimedia Commons
/