Best API Mocking Tools to Simulate Errors and Unblock QA
Compare WireMock Cloud, Mockoon, Postman and ACCELQ for mocking API dependencies, simulating errors and delays, and testing before the real backend is ready.

Quick answer: the best API mocking tool is the one that lets your team fake a dependency quickly, force the awkward responses real systems rarely give you, and run that same mock wherever your tests run. A practical shortlist:
- ACCELQ if your API automation already lives in ACCELQ and you want mocks managed in the same place as your tests.
- WireMock Cloud if several people or teams need one shared, hosted mock with stateful behaviour and fault simulation.
- Mockoon if you want a free desktop app to build mocks by hand and a CLI to run them in CI.
- Postman mock servers if your requests and saved examples are already in Postman collections.
Below we explain what mocking is for, how to judge a tool, how each one handles errors and delays, and a worked example you can copy. Features come from each vendor's public documentation; this is not a hands-on benchmark, and we do not list prices because they change often.
What API mocking is, and when it helps
An API mock is a fake version of a service. Your app or test calls it like the real API, and it answers with responses you have defined. It does not run real business logic; it just matches a request and returns a reply.
Mocking helps in four common situations:
- The real API does not exist yet. Front-end and QA work can start from the agreed contract instead of waiting for the backend.
- The real API is unstable. A shared test environment that is often down makes tests fail for reasons unrelated to your code.
- The real API is costly or risky to call. Payment gateways, SMS providers and third-party APIs with rate limits are classic examples.
- You need a response the real API rarely gives. A 503, a 30-second delay, an empty cart, an expired token. This is where mocking pays off most for testers.
Mock, stub or service virtualisation?
People use these words loosely. A stub usually returns a fixed reply. A mock often adds rules and can check how it was called. Service virtualisation usually means a richer, stateful simulation of a whole system. The tools below cover the range from simple stubs to stateful simulation. Mocking is also different from contract testing with Pact, which checks that consumer and provider still agree; the two work well together.
How to judge an API mocking tool
1. Speed to a first mock
Can you import an OpenAPI file or a collection, or record real traffic, instead of typing every response by hand?
2. Request matching
Can it return different replies based on path, query, headers or body? Real tests need "return 404 for this ID, 200 for that one".
3. Error and delay simulation
Can you return any status code, add latency, or break the connection? This is the main reason testers reach for a mock.
4. State
Can the mock remember that an order was created, so a later GET returns it? Without state, multi-step flows are hard to test.
5. Where it runs
Desktop only, a local process you can start in CI, a hosted URL anyone can reach, or inside a wider platform. This often decides the choice.
6. Sharing and keeping in sync
Can the team share one source of truth, and can you update mocks when the contract changes?
The four tools at a glance
Documented capabilities only. "Strong fit" describes the scenario each tool's documentation is built around, not a measured score.
| Tool | Where it runs | Errors and delays | State | Strong fit |
|---|---|---|---|---|
| ACCELQ | Inside the ACCELQ platform | Defined alongside API tests | Check your edition | Teams already automating APIs in ACCELQ |
| WireMock Cloud | Hosted URL | Any status, fixed or random delays, connection faults | Stateful scenarios | Shared mocks across teams and environments |
| Mockoon | Desktop app, CLI, Docker | Any status, per-route latency, rules | Data buckets and CRUD routes | Individual testers and CI pipelines |
| Postman mock servers | Postman-hosted URL | Status picked from saved examples, response delay setting | Limited, example-based | Teams already living in Postman |
ACCELQ: mocks next to your API automation
ACCELQ's API testing is a codeless platform for building and running API tests and chaining them with UI steps. For teams that already automate there, the main appeal is keeping the test, its data and any simulated dependency in one place, so nobody has to maintain a separate mock project.
Choose it when: ACCELQ is already your automation platform and you want end-to-end flows that do not break when a downstream service is unavailable.
Limits: it is a full platform, so adopting it only for mocking is heavy. Confirm which virtualisation features your edition includes before planning around them.
WireMock Cloud: hosted, shared and stateful
WireMock Cloud is the hosted product from the team behind open-source WireMock. You get a public mock URL, a web editor, OpenAPI import, and recording of real traffic into stubs. Because it is built on WireMock, the same matching rules (path, headers, JSON body) apply.
For error testing it can return any status, add fixed or random delays, and simulate broken connections, in line with the fault options documented for WireMock. Stateful scenarios let a mock move from "no order" to "order created" so a GET after a POST behaves realistically.
Choose it when: several teams or environments need the same mock, or you want to hand a URL to front-end developers, mobile apps and testers at once.
Limits: a hosted service needs network access from your tests and an account. For purely local unit-level mocks, the open-source WireMock library may be simpler.
Mockoon: free desktop app plus a CLI
Mockoon is an open-source desktop app for building mock APIs with a visual editor. You add routes, set a status, headers, body and latency for each, and add rules that pick a response based on the request. Response templating lets you echo values from the request or generate fake data.
The same mock is saved as a JSON file you can commit and run headless with the Mockoon CLI or Docker, which makes it easy to start a mock at the beginning of a CI job. It can also import OpenAPI files and act as a proxy, passing unmatched calls to the real API.
Choose it when: you are one tester or a small team, want something free to start, and need the mock to run both on a laptop and in a pipeline.
Limits: sharing is through files in Git unless you use Mockoon's paid cloud features. Complex stateful flows need more setup than in a dedicated virtualisation tool.
Postman mock servers: mocks from your collections
Postman mock servers return the saved examples in a collection. If your team already saves example responses for each request, you can create a mock in a few clicks and get a URL.
To force a specific response, save several examples (for example a 200 and a 503) and pick one with the x-mock-response-code or x-mock-response-name request header. Mock servers can also add a response delay and can be made private so they need an API key.
Choose it when: Postman is already the team's shared API workspace and you want mocks with almost no extra tooling. Compare options in Postman vs Insomnia vs Bruno.
Limits: responses are example-based, so stateful flows and dynamic logic are limited compared with WireMock or Mockoon. Usage limits depend on your Postman plan.
Worked example: testing checkout when the payment API fails
Illustrative scenario. Your team is testing a checkout page. The real payment gateway sandbox is shared, sometimes slow, and never returns a timeout on demand. You want to check three things: success, a declined card, and a gateway timeout.
Step 1: agree the contract
The payment call is POST /payments. Success returns 201 with a payment ID. A decline returns 402 with an error code. A timeout is no reply within 10 seconds.
Step 2: build the mock (WireMock-style JSON)
This WireMock stub mapping returns a decline whenever the card number ends in 0002. The same idea maps onto Mockoon rules or Postman examples.
{
"request": {
"method": "POST",
"url": "/payments",
"bodyPatterns": [
{ "matchesJsonPath": "$[?(@.cardNumber =~ /.*0002$/)]" }
]
},
"response": {
"status": 402,
"headers": { "Content-Type": "application/json" },
"jsonBody": { "error": "card_declined" }
}
}A second stub for card numbers ending in 0003 adds "fixedDelayMilliseconds": 15000 to simulate a timeout. A default stub returns 201 with { "paymentId": "pay_test_1" }.
Step 3: point the app at the mock
Change the payment base URL in your test environment config to the mock URL. Never hard-code it in the app.
Step 4: write the checks
- Card ending 0001: order confirmation page shows the payment ID.
- Card ending 0002: a clear "card declined" message, the cart is kept, no order is created.
- Card ending 0003: after the app's timeout, the user sees a retry message and is not charged twice when retrying.
Step 5: confirm against the real sandbox
Before release, run the success and decline cases once against the real sandbox to confirm the mock still matches reality. We have not run this exact snippet in your stack; check field names against your API's contract.
Want to practise the request side without building a backend? Send real requests and see status codes in the free API Playground.
Which tool should you pick?
| Your situation | Start with |
|---|---|
| API automation already runs in ACCELQ | ACCELQ |
| Many teams need one shared mock URL | WireMock Cloud |
| You need multi-step, stateful flows | WireMock Cloud |
| You want free, local, and runnable in CI | Mockoon |
| Your examples already live in Postman | Postman mock servers |
| You only need free, open-source options | See our free API mock tools list |
There is no single winner. Many teams use two: a local tool for fast developer and CI tests, and a hosted mock for shared environments.
Common problems and how to fix them
- Mock drift. The API changes and the mock does not, so tests pass while production breaks. Regenerate mocks from the OpenAPI file when it changes, and add contract tests to catch mismatches.
- Only happy paths. List every error your app handles and give each one a mock response.
- Shared state between parallel runs. Give each run its own mock instance or reset scenarios before each test.
- Request does not match. Most tools have a log of unmatched requests; check headers and body formatting first.
- Mocking the system under test. Mock only its dependencies, never the service whose behaviour you are verifying.
Why this matters in interviews
"How would you test a feature when the backend is not ready?" and "How do you test error handling for a third-party API?" are common API testing interview questions. A strong answer names a tool, explains forcing error codes and delays, and mentions checking the real service before release. Practise more in the API testing interview questions, review the bigger picture in the API testing complete guide, and compare automation stacks in best API testing tools for teams. For structured learning, start with the free QA courses.
Your next step
Pick one dependency that blocks or slows your testing today. Write down three responses you cannot easily get from it now, such as a 500, a timeout and an empty list. Build those three in Mockoon or a Postman mock this week, and add one test for each.
Not sure how to mock a tricky dependency? Describe it in the QA Community and get ideas from other testers.
Key takeaways
- 1Mock an API when the real one is missing, unstable, costly to call, or cannot easily produce the response you need.
- 2The biggest value of a mock is forcing rare responses: 500s, timeouts, empty lists, expired tokens.
- 3Pick a tool by where your team works: desktop and CI, a shared hosted URL, or inside Postman.
- 4Keep mocks in sync with the API contract (OpenAPI), or they slowly start lying.
- 5Always run a smaller set of tests against the real service before release.
Common mistakes to avoid
- Mocking only happy paths, which wastes the main reason to mock.
- Letting mock responses drift from the real API after the contract changes.
- Mocking the very service you are supposed to be testing.
- Sharing one mutable mock between parallel test runs, so tests change each other's state.
- Never testing against the real dependency before release.
References
- 1WireMock Cloud documentation— docs.wiremock.io
- 2WireMock: Simulating faults— wiremock.org
- 3Mockoon documentation— mockoon.com
- 4Mockoon CLI— mockoon.com
- 5Postman: Set up a mock server— learning.postman.com
- 6ACCELQ API testing— accelq.com
