TK
Menu

Test Automation

Postman API Tests with an Assertion Review

A chained Postman suite for the Restful Booker API, run with Newman. A 2026 review fixed a broken variable and three assertions that could never fail; all 8 assertions now pass live.

Problem

Test a booking API end to end: authenticate, create a booking, read it back and partially update it, checking not just status codes but the actual values at every step.

Approach

  • Four chained requests sharing collection variables: the auth token and the id of the booking the suite creates itself, so a run never depends on other people's data.
  • JavaScript test scripts (pm.test with Chai) on every request, run from the command line with Newman in Docker.

Result

A 2026 re-run failed one test, and a review of the scripts found more:

ProblemEffect
The GET used a variable that was never setIt fetched all bookings, so the test failed
Create checked two fields that don't exist (one misspelt) with not.equalundefined never equals anything, so they could never fail
Update checked checkout instead of bookingdates.checkoutAlso could never fail
The token was stored with quotesWorked by luck

After the fixes, every assertion checks a real field, and the live run on 2026-11-16 passed 8 of 8 assertions across 4 requests.

What this shows

API test design with chaining, and the habit of testing the tests: the original run was "all green", but three of its passes proved nothing.