Skip to content
RedaEkengrenPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Postman API Testing

Working through the radwanSQA Postman repo as practice. Three collections, all run via Newman.


Collections

Collection API Requests Assertions
BookingApi restful-booker.herokuapp.com 6 9
FakeRestApi fakerestapi.azurewebsites.net 27 0
StudentInfoApi thetestingworldapi.com 7 25

BookingApi

Hotel booking API. Tests the full create/read/update/delete flow with token auth.

Request Method Notes
CREATE booking POST Saves returned bookingid as {{Id}}
GET booking GET Reads back what was just created
token POST Gets auth token, saves as {{accessToken}}
UPDATE booking PUT Needs the token in Cookie header
DELETE booking DELETE Needs the token in Cookie header

The original collection had token after UPDATE — so UPDATE always got a 403 because the token didn't exist yet. Moved token before UPDATE, now it works.


FakeRestApi

Five resource types: Activities, Authors, Books, Cover Photos, Users. Each has the standard GET/POST/GET by ID/PUT/DELETE requests. No assertions written in this one.


StudentInfoApi

Student management API. Creates a student, adds an address, then fetches the combined record.

Request Method Notes
GET Students GET List all
CREATE Student POST Saves {{id}}
GET Specific Student GET 4 assertions fail — see report
UPDATE Student PUT
Create Address POST Links address to student
Final Student Details GET Validates student + address together
DELETE Student DELETE

Running with Newman

npm install -g newman newman-reporter-htmlextra

newman run "BookingApi/booking.postman_collection.json" \
  -e "BookingApi/booking.postman_environment.json" \
  -r cli,htmlextra \
  --reporter-htmlextra-export reports/BookingApi-report.html

Useful test snippets

// Save value from response to use in next request
var jsonData = pm.response.json();
pm.environment.set('Id', jsonData.bookingid);

// Basic status check
pm.test("Status 200", function () {
    pm.response.to.have.status(200);
});

// Check response fields
pm.test("Check fields", () => {
    const json = pm.response.json();
    pm.expect(json.firstname).to.eql('Test');
    pm.expect(json.bookingid).to.be.a('number');
});

Demo APIs to practice on

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages