Introduction
🌐 Stoobly is an API mock framework with seamless CI setup that enables E2E testing.
⚡ Easily create realistic API mocks by recording HTTP(S) requests.
💡 Maintaining mocks gets expensive. Streamline maintenance with stale mock detection and automated regeneration.
🚀 Minimize regressions of customer workflows with fast and reliable E2E tests.
🔨 Supercharge CI setup with ready-to-go tooling. Reduce CI setup time from two weeks to one day.
Why Mock APIs?
Roughly an additional 50% of time spent in development is needed for testing and validation. This includes writing unit, integration and end-to-end testing as well as the mocks to support them.
Mocking out APIs results in more reliable and faster tests.
Tests that make requests to upstream APIs can suffer from intermittent failures due to updates or downtime. Because upstream APIs can also call other APIs, depending on live services tend to make tests slow.
Having flaky and slow tests means more time is spent debugging and less time spent on core features.
Current State of API Mocking
While many tools exist for API mocking, most are suited for more trivial integration tests or don't offer enough features to cover more advanced use-cases.
Several classes of API mocking tools include:
Language specific libraries such as Mockito, rspec-mocks, etc.
Below we summarize creating and maintaining API mocks using the above solutions.
Creation
Creating the initial API mocks are an upfront time cost by Software Engineers and QA Engineers.
The following lists challenges with creating API mocks and highlights existing solutions:
Creating realistic response stubs
Hard-coding responses
Use of faker libraries
Precisely matching requests with responses
Using strict or pattern-based URL matching to map requests to responses
Headers and bodies are not taken into account
Maintenance
Maintenance is a variable time cost by Software Engineers and QA Engineers. Every time the request or response contract changes, mocks have to be modified. This becomes a time-consuming process as more and more API endpoints are added. Time spent maintaining scales exponentially with the number of request variations.
The following lists challenges with maintaining mocks and highlights existing solutions:
Determining which requests and responses need updating
Work with service maintainers
Audit change logs of upstream API changes
Wait for tests that depend on an out-of-date response to fail
Updating mock request variations with up-to-date parameters and/or responses
Manually copy/paste or edit the request and/or response
How Stoobly Helps
Creation
Stoobly makes creating mocks fast and accessing them precise.
The following lists challenges with mocking and highlights how Stoobly can help:
Creating realistic response stubs
Mocking APIs built from recorded requests
Rewrite any part of the request to filter sensitive data
Precisely matching requests with responses
Matching based on URL, bodies and/or headers
Maintenance
Stoobly helps minimize the impact of having to maintain mocks.
The following lists challenges with maintaining mocks and highlights how Stoobly can help:
Determining which requests and responses need updating
Shared maintenance, updates by producer can immediately be accessed by consumers
Updating mock request variations with up-to-date parameters and/or responses
Support replaying requests and recording the responses
Group a sequence of requests into scenarios and batch replay and record
To learn more see our Generating Mock APIs use case!
Last updated