Creating Postman Test Libraries

Learn how to create your own Postman test libraries.

Why we need a custom Postman test library

Sometimes writing tests can seem a bit tedious. It definitely takes time and commitment to create valuable tests that won’t break easily as we modify our API over time. Also, one of the advantages of BDD-style assertion kits like the Chai.js library is that it has a fluent interface that results in a lot of text for us to type when we’re writing the tests. For this, and other reasons, we have created some Postman test libraries that we can easily add to any Postman collection to make writing comprehensive tests a bit easier and faster.

Example of a custom Postman test library

Let’s say we have a Postman test library that includes a number of handy functions for writing protocol-structure-value test collections like the one we saw previously. The following summary gives us an idea of how the library looks:

Get hands-on with 1200+ tech skills courses.