The sweet future of API mocking: pollinating development practices

Jason English
Director & Principal Analyst, Intellyx
May 9, 2024

Part 4 of the Modern API Mocking Series 

by Jason English, Director & Principal Analyst, Intellyx

What is the future of API mocking, and how will it fit within the enterprise development landscape? 

In our first post of this series, Eric Newcomer introduced API mocking as a methodology for improving developer productivity and quality. Then, I explored how simulation and documentation can ease API onboarding concerns. From there, Eric discussed the use of API mocking to advance software design and solution prototyping cycles. 

Now it’s time to think about what happens next. API mocking can become ubiquitous as a practice, much like previous flavors of service virtualization, lab management, and continuous delivery, but then the question to be asked is how will it support software delivery and development work?

Even if API mocking isn’t the ‘main course’ of what a distributed development team cooks up—it is an essential ingredient. Or more precisely, a necessary catalyst for predictably producing good software. 

Most of our work hours will still be spent iteratively gathering requirements, coding, testing, deploying, operating, and resolving incidents. However, much like a honeybee affects so many other patterns of the natural ecosystem around it through pollination, from clover, to flowers, and fruiting trees, API mocking may become an essential catalyst for successful software delivery.

Is API mocking in a category of its own?

Perhaps someday the leading analyst firms will put API mocking into its own technology space, replete with a quad-wave matrix report ranking competing vendors, but it’s really not productive to confine it to one bucket.

API mocking is not as easily categorized as other solutions. Yes, it has obvious testing applications, but it’s not a test tool. It can also be a part of continuous delivery and DevOps tool chains, but it’s not a dev tool by itself. It can make mocks from production instances to reproduce incidents, but it’s not really an Ops tool.

Mocks can also certify an interface between trading partners, and contribute to application design, while helping mitigate operational risk with mocks as compliance checks. In essence API mocking is a catalyst for integrating, assuring and governing many other services and technologies, all of which will ultimately be exposed and consumed as APIs.

Here’s just a few of the places we can see API mocking as a future enabler for other advanced practices.

Feature management

It’s easy to draw parallels between the current rise of API mocking with Feature Management solutions, which started to gain traction in 2016 or so. 

Feature management offered software development teams the ability to toggle releases or route user traffic between discretely defined software features, whether front-end options for A/B testing and user experience, or back-end configuration alternatives for gradual blue-green releases and progressive canary testing and incident detection.

Early-to-market vendors like LaunchDarkly and Split might have started the feature-flagging sensation, but soon we would see other CI/CD vendors like Octopus Deploy, Harness and CloudBees getting in on the game, because in a sense, feature management is very closely associated with the DevOps methodology itself, and might as well be incorporated into the delivery pipeline.

Rather than early simulation for shift-left testing, feature flagging involves active monitoring for real-world production instances, which is more of a ‘shift-right’ paradigm. But here’s a cool twist.

What if API mocking could capture the live results of such alternative feature deployments, documenting them as ready-to-run API definitions within the CI/CD lifecycle? Then, we could still run shift-right progressive tests, but also shift-left the validation of these alternative features before they ever have a chance to impact production users.

Feature management just found its new best friend.

Resilient regression testing

An application development shop may build up a huge library of regression tests to validate expected behaviors and check for previously encountered faults, but over time, the usefulness of tests themselves will fade, especially when there are constant upstream or downstream API changes.

Why wait for test attrition to invalidate tests, and create non-value-add work maintaining and recoding tests? Let API mocking capture the conditions that create every broken test, and use observed requests and responses to simulate the environment state at every break.

Chaos engineering

Who would want to break things on purpose? When Netflix revealed the “chaos monkey” inside its engineering shop in 2011, software developers and IT Ops teams were stunned by this fault-injecting animal, which they later open sourced.

Since then, we’ve seen a number of vendors enter their own complex chaos engineering solutions into the fray, but the concept is simple—create non-functional error conditions and performance hits, and see what happens to the application under test (or, under chaos).

API mocking offers an excellent opportunity to inject faults and ensure resiliency. WireMock Cloud offers a chaos testing module you can toggle on and ratchet up to simulate a library of unexpected effects, from unresponsive APIs and failed connections, to corrupt payloads, in order to design alternatives and workarounds. 

When you capture API traffic, you capture problems. Using chaos engineering practices, a mobile app design team can work in parallel with website development and customer engagement and support, to trap real-world problems as they occur, and iteratively improve application resiliency.

AI model interaction

Each GenAI model or applied machine learning feature is created and trained differently, but for consuming applications, these models are usually abstracted behind an API which can be queried. So, what responses can we reasonably expect to see from different AI models?

The application development or testing team should never need to replicate the millions of parameters that exist within an LLM or deep learning system applied to a specific business problem. Nor should they always need to spend the money or resources calling on an AI to figure out how it would reasonably respond to certain types of prompts.

Mock APIs come to the rescue here as well using a headstart module for AI like MockGPT, which can provide a ‘good enough’ simulation of both happy-path and edge condition AI requests and responses as they are represented within an application workflow.

Platform engineering at Agibank

The practice of platform engineering—providing developers with ready self-service resources and infrastructure so they can deliver software faster with a minimum of hassle and provisioning requests— has really caught fire within development shops over the last few years.

Agibank is a Brazil-based fintech with 40 engineering squads building application features for credit, investments, insurance and more, each of which relies on interactions with APIs provided by government institutions and other banking partner services.

Using the WireMock solution for API mocking, the team was able to thoroughly prototype and test production-ready services, even if the upstream or downstream third-party APIs are unavailable or have limited testing data. All they need to know is how HTTP requests work.

“Without that mock structure here, we do not have an integration test environment,” says Sergio Rubio, Quality Assurance Specialist, Agibank. “And without this environment, I cannot properly test features or services end to end before they go to production. WireMock helps us get there much faster.”

The Intellyx Take

I love almonds, and usually have a bowl of them handy. In addition to careful tending, almonds require lots of sun, good soil, and plenty of water to grow—but each almond has to be visited by a bee before it can mature from a flower to a seed—that essential catalyst for growth.

API mocking is a lightweight-but-mighty part of enabling many other well-known technology spaces and progressive DevOps practices. Which is a good thing, because with very low system overhead and cost, mocks can help us solve many of the world’s toughest challenges of API-driven application design, interdependency, performance, quality, and partner engagement.

The conditions captured in API mocking provide essential documentation and knowledge transfer for cross-pollination between teams, business partners, technology services, and even AI models. So let’s get beyond the buzz, and get busy!

©2024 Intellyx B.V. Intellyx is editorially responsible for this document. No AI bots were used to write this content. Image source: Adobe Express AI. At the time of writing, WireMock is an Intellyx customer.

/

Latest posts

Have More Questions?