How to Do End to End API Testing: Journeys, Data and Checks
End to end API testing follows a business journey across several calls and proves the result. Here's a six-step method, how to decide coverage, and an order lifecycle built as a workflow on the sandbox store.
This is lesson 6.6 of Test Data, Mocks and End-to-End API Testing. Lessons 6.3 to 6.5 prepared the data; now you use it across a whole journey. For the workflow editor itself, see lesson 9.8; this lesson is about deciding what to build.
How to do end to end API testing
Here's how to do end to end API testing in one line: pick a business journey, run its calls in order, carry each step's output into the next, check every step, and finish by reading back what the journey wrote. The hard parts aren't the calls. They're choosing which journeys deserve a test, keeping the data between steps straight, and proving the final state rather than trusting a row of green status codes.
What is end to end API testing?
An end to end API test follows a journey the business cares about, such as "a new shopper orders a product and the order moves to processing", through every API call it takes. It's the API-level version of what a user does in the app, without the UI.
API testing vs end to end testing
| Single-endpoint API testing | End to end API testing | |
|---|---|---|
| Unit of test | One call | A journey of several calls |
| Data | Each test brings its own | Each step uses earlier steps' output |
| Finds | Wrong status, missing field, bad validation | Broken hand-offs, state that doesn't stick, wrong order of effects |
| Number of tests | Hundreds | A handful per area |
| Speed | Milliseconds each | Seconds per journey |
| Failure tells you | Which endpoint and field | Which step of which journey |
Both are needed. The single-endpoint suite catches most bugs cheaply; the journeys catch the bugs that only appear when calls follow each other.
Six steps, on the sandbox store
1. Pick the journey from requirements. The sandbox's requirements document lists ten end-to-end scenarios, E2E-01 to E2E-10. E2E-01 is the shopper-to-fulfilment lifecycle: create a user, list a product, order it, read it back, move it to processing and on to completed.
2. Write the steps with their data. For a short version:
| Step | Call | Carries forward |
|---|---|---|
| 1 | POST /api/v1/users with a name and email | data.id as userId |
| 2 | POST /api/v1/orders with userId, the Wireless Mouse and quantity: 2 | data.id as orderId |
| 3 | PATCH /api/v1/orders/{orderId} with status: processing | nothing |
| 4 | GET /api/v1/orders/{orderId}?expand=user,product | nothing: this is the proof |
Try step 2 by hand:
/api/v1/orderscurl -X POST 'https://demo.totalshiftleft.ai/api/v1/orders' \
-H 'Content-Type: application/json' \
-d '{"user_id":"11111111-1111-1111-1111-111111111111","product_id":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","quantity":2}'3. Assert at every step. Step 1: 201, and role defaulted to user. Step 2: 201, status is pending, quantity is 2. Step 3: 200, status is processing.
4. Read back the result. The last step checks the state the journey left behind, through a different call than the one that wrote it: the order's status is processing, its user is the one step 1 created, its product is the Wireless Mouse. A read-back like this is what turns a sequence of calls into evidence:
/api/v1/orders/dddddddd-dddd-dddd-dddd-dddddddddddd?expand=user,productcurl -X GET 'https://demo.totalshiftleft.ai/api/v1/orders/dddddddd-dddd-dddd-dddd-dddddddddddd?expand=user,product'5. Own the data. The journey creates its own user and order, so it can't collide with another test, and it uses a seeded product it never changes. Reset or clean up as part of the suite (lesson 6.4).
6. Decide where it runs. Journeys belong in an environment where every service in the journey is real. Mock a dependency only when it's outside the journey's purpose.
How do you cover end to end API testing?
Not by combinations. Field-level variations belong in single-endpoint tests. For journeys, aim for:
- One happy journey per use case. The store's use cases map to E2E-01 (order lifecycle), E2E-03 (catalogue maintenance) and so on.
- One rejected-step journey. E2E-07 sends an invalid order (
quantity: 0), checks the 400, then checks the order count didn't change before sending the corrected order. "Rejected requests leave nothing behind" is a journey-level property no single test can prove. - One recovery journey. E2E-08 uses the sandbox's
?error=500and?random_fail=trueto check that a failed step has no side effects and a retry succeeds. - Journey-wide checks. Error rate across all calls, and a latency budget for the journey as a whole.
Common mistakes
- Only checking status codes. Four 2xx responses don't prove the order ended up in the right state. Read it back.
- Trusting a pass rate. A step that never ran isn't counted as failed. Check the list of steps that actually ran.
- Hard-coding IDs from a previous run. Carry them forward from the step that created them.
- Too many journeys. Each one is slow and brittle compared with a single-endpoint test. Keep the set small and meaningful.
End to end API testing in Shift-Left API
In Shift-Left API, a journey is a workflow: test blocks on a canvas, run in order on the server, step after step. Workflows are in every edition; the free edition holds up to 50 workflows of up to 10 blocks each, Start and Stop included.
- Make four tests on the sandbox store: Create a user, Place an order (product
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa), Update the order (PATCH, body{ "status": "processing" }) and Read the order back (expand=user,product). - Click Workflows, create one, and drag Start, the four tests from the Test Library, and Stop onto the canvas.
- Wire green connectors for the order of the steps. On Create a user and Place an order, extract
data.idasuserIdandorderId, and feed them forward with blue data connectors:userIdinto the order'suser_id,orderIdinto theidof the last two steps. - On Read the order back, add checks:
data.statusequalsprocessing,data.user.nameequals the name step 1 sent,data.product.nameequalsWireless Mouse. - Click Launch Workflow, then read the per-block report: every block should show PASSED. Click Check workflow if a block is missing; Workflow Doctor names steps that can't be reached, inputs no earlier step provides, and
{{tokens}}nothing sets.
Two more ways to get journeys. Red failure connectors route a failed step to a different path, and workflow-level assertions check the whole run: error rate, throughput, and response time at p50, p95 or p99. And if your requirement documents describe use cases with ordered steps, Shift-Left API builds the workflow from them once every step has a test, and names the missing step when one doesn't (lesson 9.2 covers requirements). The integration test workflows feature page lists the block types.
Try it yourself
Build the four-step journey above as a workflow, wire userId and orderId with blue connectors, and launch it. Then change the PATCH body to { "status": "shipped" }, which the store doesn't allow, and see which block fails first.
Recap
- How to do end to end API testing: pick a journey from requirements, carry data forward, assert each step and read back the final state.
- API testing vs end to end testing: many fast single-endpoint tests catch most bugs; a few journeys catch the hand-off bugs between calls.
- How do you cover end to end API testing: one happy, one rejected-step and one recovery journey per use case, plus journey-wide checks.
For journeys that cross several services, read end-to-end API testing for microservices.
Try it: Build a workflow on the sandbox store: Create a user, Place an order (product aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa), Update the order with PATCH status processing, then Read the order back with expand=user,product and assert data.status equals processing and data.user.name equals the name you created. Wire userId and orderId with blue data connectors and run it.
Frequently asked questions
What is end to end API testing?+
It tests a complete business journey through an API, such as register, order, fulfil, rather than one call. Each step uses values earlier steps returned, checks its own response, and the journey ends by reading back what the earlier steps wrote. It proves the calls work together in the order real clients use them.
What is the difference in API testing vs end to end testing?+
API testing checks one endpoint at a time: its inputs, outputs, errors and contract. End to end testing checks a journey across several endpoints, sometimes across several services and a UI. API tests are many, fast and isolated; end to end tests are few, slower and test the seams between steps.
How do you cover end to end API testing without hundreds of journeys?+
Cover journeys, not combinations. Take the use cases in your requirements, keep one happy journey per use case, add one journey for the most important rejected step and one for recovery after a failure, and leave field-level variations to single-endpoint tests. A handful of journeys per product area is usually enough.
Related lessons
One test checks one call. A journey needs steps in order, values carried forward and proof that every step ran. Chain tests on a canvas in Shift-Left API, and let Workflow Doctor find the step that never ran.
API integration testing checks the seams, such as what happens to an order when its user is deleted. Here's how it differs from API testing, the practices that keep it reliable, and a cross-resource test.
A spec says what's valid, not what the business needs. Upload a requirements document to Shift-Left API, review what it extracts, and generate tests that trace back to each rule.
Read more on the blog
How to do end-to-end API testing for microservices: chaining calls across services, handling async steps, environments, service virtualization, test data, frameworks and CI/CD, with a worked checkout example.
End-to-end testing and API testing both validate that software works correctly, but they operate at different layers, speeds, and costs. The evidence strongly favors API testing as the primary investment: faster, cheaper, more reliable, and catching 80-90% of defects before they require expensive UI reproduction. This guide provides a comparison table and makes the case for an API-first testing strategy.