Chapter Exercise

For this exercise, we’ll create a Postman test collection for the credit-check API you built in the previous chapter. After creating a new collection and adding both happy- and sad-path tests, we’ll run them to validate the API.

For extra credit, you can export your API and run it locally using the newman utility to produce an HTML report.

Write the Credit-Check Postman Test Collection

First, fire up your Postman client app and create a new collection called Credit-Check. Then create the following two test entries:

Happy-Path Test

  • Test the home resource
    • Request URL: http://localhost:8181/
    • Method: GET
    • Body: None
    • Protocol Tests
      • http status equals 200
      • content-type includes application/json
    • Structure Tests
      • home object at the root is ...

Get Design and Build Great Web APIs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.