API Mocking Tools: Buyer’s Guide and Market Landscape
There is no shortage of API mocking tools. Uncoincidentally, API usage itself has grown substantially in recent years: companies purchased more SaaS (which they needed to integrate), including many API-first services; at the same time, microservices became the de-facto norm for new software projects, creating endless internal API dependencies.
Software teams were often getting blocked by these dependencies – and thus, a market for API mocking tools has emerged. Today developers have a broad array of options, ranging from free open-source tools to enterprise-grade virtualization platforms. Let’s take a look at what's currently out there, and offer some pointers on how to navigate the similar-sounding-but-actually-quite-different offerings.
What are API mocking tools? What are they used for?
API mocking tools are applications used to simulate actual APIs for testing and development purposes. By providing realistic responses to requests, they allow developers to test their code in real-world scenarios, even when the API being simulated is unavailable (either because it's down, or because it's not ready yet). Mocking can reduce cycle times and increase developer productivity.
For example, a frontend application might depend on data pulled from a backend API endpoint that is still in development. Using an API mock allows the frontend devs to keep developing instead of waiting for their backend counterparts. They can see how their app performs in a relatively realistic environment. Alternatives such as using static JSON might not reflect the actual output they would get from the live API, eventually leading to more time being spent on integration testing.
Build vs buy, hosted vs local
Once you’ve realized you need a solution, there are two decisions you’ll need early: (1) whether you want to purchase an API mocking tool, or develop something in-house, from scratch or using open source software; and (2) whether you need a hosted mock server or can settle for running one on your local machine.
We’ve addressed both of these decisions in detail in our previous article, Creating a Mock API Service - 6 Questions You’ll Need to Answer. The TL;DR of what we wrote there is:
- The build/buy question depends on your organization’s general approach to purchasing software. You should consider the time and resources needed to deploy and maintain the mock service, secure it with SSL, edit mocked responses, generate detailed logs, debug issues, keep the mock in sync with the real API, and enable collaboration.
- Local mock services can be used when you are only running unit tests, as these can be conducted on your local machine. When you’re running integration tests, you’ll need a service that’s hosted on your network, can be reachable via an IP address, and has a DNS name.
Considerations for Evaluating API Mocking Tools
Before we dive into the current market landscape, let’s quickly review what you should look out for when it comes to choosing a mocking service – core functionality that you’re going to need as your testing needs evolve.
Key features to evaluate:
- Flexible request matching – your app is likely meant to address more than one type of business logic. To simulate this, the mock API should support the ability to match requests using multiple criteria such as request URLs, headers, payloads, and more.
- Simulate different responses to identical requests – in real life, the same API call might return a different response code or data. If your mocked responses are always identical, you might run into unexpected issues in production.
- Simulate unpredictable behavior (and failure states) - applying the concept of chaos engineering, you’ll want to simulate diverse fail states, timeouts, and delays in order to gauge the resilience of your application.
- Dealing with API changes - 3rd party APIs can often change with little to no warning. In these cases, it should be easy to update the mock without needing to re-configure it from scratch.
- Collaboration features – using a cloud tool should make it easy for developers to collaborate around testing and API design, and ensure different teams are developing against the same mock.
- Developer tools: Integration with CI/CD tooling and a well-documented SDK are crucial for scaling your use of mock APIs.
- Ease of use: Creating and modifying mocks should be simple, without sacrificing more advanced functionality.
Types of different API mocking tools
There are dozens of different mock tools available, and comparing each one on a feature by feature basis is largely pointless (and also not something we can objectively do, as a company operating in this space). What we can do is suggest a way for you to look at the categories of tools currently available and find the best fit for your use case. At the end you’ll see where WireMock Cloud fits in, and how it addresses the current gaps in the marketplace.
Low cost SaaS tools
Examples: Mocky, Mockable, SmartMock
When to use: There are many low-cost or freemium tools available, and these should be your go-to if you’re looking to save time on simple projects and need a low cost option. They will provide basic request matching and a limited level of templating or dynamic responses.
Limitations: Apps in this category are typically meant to provide a quick and cheap solution. They would offer limited to no support for on-premises deployment, chaos engineering, advanced request matching, or integration with CI/CD.
API design platforms
Examples: Postman, Spotlight, Swaggerhub
When to use: These are typically larger scale tools which are built to support the teams developing the API. Basic mocking functionality is provided to assist with the API design process.
Limitations: If you’re just looking for API mocking, investing in an API design platform is complete overkill (in both complexity and money). But even if your organization already has a license to one of these platforms, you’ll find that their mocking functionality is often limited – it is provided as just one of many non-core features, and is typically fairly basic and similar to what you might find in a low-cost SaaS tool.
Open source options
Examples: WireMock, Mockserver, Mountebank, Hoverfly
When to use: Open source tooling is a good way to avoid vendor lock-in and customize the solution according to your requirements - while also saving on licensing costs.
Limitations: Like any OSS, tools that fall under this category would have a learning curve and be heavily geared towards developers who are willing to put in the time and effort. Maintenance is also a consideration if you need a hosted solution.
Examples: ReadyAPI, Parasoft, TrafficParrot
When to use: Service virtualization tools simulate multiple components within an application. They are enterprise-grade solutions that require a large upfront investment and a significant amount of effort to stand up.
Limitations: Expensive and heavyweight solutions are not known for accelerating development processes. Additionally, many of these tools were built for legacy environments, are not cloud native, and offer limited support for integration with CI/CD tools.
WireMock Cloud: a new breed of API mocking service
Yes, we did put ourselves in a separate category… because we’re a separate kind of tool. WireMock Cloud is a cloud-native API mocking platform that provides the robust and flexible mocking capabilities that modern development teams need, packaged in a lightweight and easy-to-use service that can be used by teams of any size, skill level, or budget.
- Built on WireMock (and by the same developers), one of the most widely used open source mocking frameworks – providing a high level of extensively, flexible deployment options, and a large community of developers
- Focused on supporting API consumers rather than API producers, with functionality that’s meant to support a broad range of real life testing and development scenarios where developers have a high level of dependency on APIs
- Advanced features including chaos engineering, dynamic response matching and dynamic request matching. Check out our product page to explore many additional features.
If you’re ready to check it out, WireMock cloud is free forever for smaller use cases. Start mocking now and let us know what you think!