Contract tests vs end-to-end tests for APIs
"Contract test" and "end-to-end test" get used loosely, and teams argue about which they need. The useful answer is both, for different questions:
- A contract test asks: does this endpoint still answer in the shape clients expect?
- An end-to-end test asks: does this workflow still work, across every service it touches?
They fail for different reasons and cost different amounts to run, so it pays to know which is which.
Contract tests
A contract test sends one request and checks the response's shape: status code, required fields, types, enum values. It doesn't care whether the order total is 42 or 43, only that total is a number.
{
"type": "object",
"required": ["id", "status", "items", "total"],
"properties": {
"id": { "type": "string" },
"status": { "enum": ["pending", "paid", "shipped", "cancelled"] },
"items": { "type": "array", "items": { "required": ["sku", "qty"] } },
"total": { "type": "number", "minimum": 0 }
}
}What they catch: renamed and removed fields, type changes, new enum values, wrong status codes. The things that break clients. See Testing API versioning and catching breaking changes.
What they miss: whether the data is right, and whether the workflow works across services.
Cost: low. They run in seconds, don't need much test data, and rarely flake.
End-to-end tests
An end-to-end API test chains requests through a real workflow: sign up, log in, add to cart, check out, check the order, check the email was queued. Each step uses values from the one before.
// "Create order" post-response
pm.test('order created', () => pm.response.to.have.status(201));
pm.environment.set('orderId', pm.response.json().id);// "Pay order" post-response
pm.test('payment accepted', () => pm.response.to.have.status(200));// "Get order" post-response: the end state, after both services did their part
pm.test('order is paid', () => {
pm.expect(pm.response.json().status).to.equal('paid');
});What they catch: integration bugs. The payment service and the order service disagree on an ID format; a queue consumer is down; a migration missed a column.
What they miss: they cover the paths you wrote, not the shape of every endpoint.
Cost: higher. They need a whole environment, real-ish data and cleanup, and a failure can come from any service, including flaky ones.
A split that works for small teams
| Contract tests | End-to-end tests | |
|---|---|---|
| Scope | Every endpoint | 3 to 10 key workflows |
| Where they live | Each request's Tests tab | A folder per workflow |
| Runs | Every pull request | After each deploy to staging, and on a schedule |
| A failure means | The API changed shape | Something in the chain broke |
Both live in the same collection. The contract checks sit on each request; the workflows are folders that reuse those requests in order. One command runs either:
# Every pull request: all requests, shape checks
requestarium run-collection "Shop API" --env Preview
# After deploy: just the checkout workflow
requestarium run-collection "Shop API" --folder "Workflows/Checkout" --env StagingTo run workflows across several collections, group them into a test suite.

Which to write first
If you have neither: contract tests. Click Generate from response in a request's Tests tab and you have the start of one in seconds. Do that for every endpoint, tighten the checks, and run them in CI.
Then pick the workflow whose failure would cost the most (usually sign-up or checkout), write it as an end-to-end folder, and run it after every deploy. Add more workflows only when a real incident shows you need them.