Testing guides
How to test an API so that you can trust it: what to check, how to organise the checks, and how to do each kind of test with ApiWorkbench and Mock Studio. The guides teach the method first and the buttons second, so they stay useful whatever tool you use later.
Where to start
Read firstAPI testing fundamentalsWhat a test is, what to check in every response, and the kinds of test.PlanWrite a test planDecide what to test before you test it. Includes a template to copy.PlanWrite test casesTurn an endpoint into a list of scenarios. Includes a template and worked examples.Keep handyChecklistsOne-page lists for an endpoint, a release and a review.
Kinds of test
| Guide | The question it answers | Practise in |
|---|---|---|
| Functional testing | Does each endpoint do its job for valid input? | Todo API |
| Negative testing | Does it refuse bad input properly? | Todo API |
| Testing authentication | Is it locked to the right people? | Shop API |
| Workflow testing | Does a whole user journey work, step after step? | Shop API |
| Data-driven testing | Does it hold for many inputs, including the edges? | Shop API |
| Testing with mocks | How do I test when the real API is missing or awkward? | All three |
| Resilience testing | What happens when the API is slow, failing or down? | Flaky Payments |
| Load testing | How does it behave with many users at once? | Shop API |
| Monitoring | Is it still working right now? | Any |
| Automating in CI | How do the tests run by themselves on every change? | Any |
The two tools, and what each is for
| ApiWorkbench | Mock Studio | |
|---|---|---|
| Plays the part of | The client: it sends requests | The server: it answers them |
| You use it to | Check that an API behaves correctly | Stand in for an API, and misbehave on demand |
| Key features for testing | Tests, captures, scripts, the runner, data files, load testing, a command-line runner | Rules, sequences, random answers, latency, faults, flows, proxy and record |
Used together they make a complete practice ground: Mock Studio is the API, ApiWorkbench tests it, and nothing needs the internet. The sample projects are exactly that.
A sensible learning order
- Fundamentals, then the Todo API lab.
- Test cases, functional and negative testing.
- Authentication, workflows and data-driven testing, with the Shop API lab.
- Mocks and resilience, with the Flaky Payments lab.
- Load, monitoring and CI.