Skip to content

github-rhobin/restful-booker-api-test

Repository files navigation

Practice Project: Restful-Booker API (Postman + Bruno)

A practice project built in Postman and Bruno to learn and experiment with automated API testing across two modern API clients. It covers the basic CRUD lifecycle of the Restful-Booker platform, moving through creating, reading, updating, and deleting booking records while also demonstrating API test scripting, dynamic variable isolation, and automated validation workflows.

🚀 Key Automation Features Included

  • Dual-Platform Coverage: Maintains an identical CRUD test suite in both Postman (.json collection) and Bruno (.yml collection), showcasing the same API tests across two different API clients.
  • Dynamic Variable Chaining: Automatically extracts the bookingid, firstname, and lastname from runtime responses and forwards them dynamically into downstream GET, PUT, PATCH, and DELETE requests.
  • Dynamic Payload Validation (PATCH): Implements an advanced JavaScript algorithm (Object.keys()) that dynamically iterates over and validates only the specific partial update fields sent in the request body, leaving unpatched values safely unverified.
  • Security Best Practices: Isolates environmental secrets (token, basicAuth) into transient client memory variables rather than hardcoding credentials into shared source code files.
  • Negative Testing Coverage: Automatically fires a post-deletion GET query targeting the scrubbed resource ID to explicitly verify the platform natively handles record destruction with a strict 404 Not Found response code.

📋 API Execution Sequence Workflow

The collection runner executes requests in this precise architectural order to maintain strict data integrity:

  1. Ping Check: Queries /ping to confirm the backend microservices are up, awake, and responsive.
  2. Auth Token Generation: Logs in using administrative credentials to securely seed runtime cookies.
  3. Create Booking: Generates a brand-new database entry and initializes the global runtime context.
  4. Get Booking (Bulk): Validates bulk array properties and payload structure contracts.
  5. Get Booking (Filtered): Targets filtering layers to assert the created runtime record resolves via structural properties.
  6. Get Booking (Single): Retrieves the individual booking by ID and validates that the returned details match the created record.
  7. Update Booking (PUT): Fully overrides the target booking database object and matches data consistency constraints.
  8. Partial Update (PATCH): Modifies sparse payload data configurations using smart loop-level testing checks.
  9. Delete Booking: Completely terminates the runtime test object and captures structural feedback string markers.
  10. Verification Check: Confirms total item extraction from backend index structures.

🛠️ Step-by-Step Installation & Execution Guide

Follow these simple steps to import and run this automated suite on your local desktop machine. Two API client suites are provided — choose Postman or Bruno below.


Postman Suite

1. Download the Suite Template

Clone this repository or click the Code dropdown button above to download the raw collection JSON file to your computer.

2. Import Into Your Postman Client

  1. Open your Postman Desktop Application Workspace.
  2. Click the Import button at the top-left of the dashboard navigation bar.
  3. Drag and drop the Restful-Booker API.postman_collection.json file into the UI drop zone.

3. Setup Collection Environment Variables

Click the imported Restful-Booker API collection, go to the Variables tab, and set these values in the Current Value column:

  • baseUrl: https://restful-booker.herokuapp.com
  • username: admin
  • password: password123
  • basicAuth: Basic YWRtaW46cGFzc3dvcmQxMjM=

4. Fire the Automated Runner

  1. Click the Three Dots ... next to the collection name.
  2. Select Run collection.
  3. Verify all requests are ticked in sequential order.
  4. Click the blue Run Restful-Booker API button.

Bruno Suite

1. Download the Suite Template

Clone this repository or download the Restful-Booker API - Bruno/ directory to your computer.

2. Open the Collection in Bruno

  1. Open your Bruno Desktop Application.
  2. Click Open Collection and navigate to the Restful-Booker API - Bruno/ folder.
  3. Click Open — Bruno automatically loads all requests organized into Ping, Auth, and Booking folders.

3. Configure Collection Variables

Variables are pre-configured in opencollection.yml. Verify these values under the collection settings:

  • baseUrl: https://restful-booker.herokuapp.com
  • username: admin
  • password: password123
  • basicAuth: Basic YWRtaW46cGFzc3dvcmQxMjM=

4. Execute the Suite

  1. Click the Run button at the top of the Bruno window.
  2. Select Run Collection and confirm all requests are selected in the correct sequence.
  3. Click Run to execute the full CRUD lifecycle and monitor the test results in real-time.

🏆 Acknowledgements & Resources

Special thanks to the creators of the open-source tools and platforms that made this practice project possible:

  • Restful-Booker API: Created by Mark Winteringham, this fantastic, free web application served as the target sandbox environment for executing all CRUD operations.
  • Postman: The primary API client tool used to build, organize, debug, and run the automated test suite loops.
  • Bruno: An open-source API client used as the second platform to mirror the same CRUD lifecycle with equivalent test coverage.
  • Postman Console Tool: Utilized for live debugging and runtime tracking of variables and console logs.

About

A practice project built in Postman and Bruno to learn and experiment with automated API testing across two modern API clients.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors