Home / Companies / Postman / Blog / Post Details
Content Deep Dive

Writing a behaviour driven API testing environment within Postman

Blog post from Postman

Post Details
Company
Date Published
Author
Shamasis Bhattacharya
Word Count
942
Company Posts That Month
3
Language
English
Hacker News Points
-
Post removed?
No
Summary

The author discusses the creation of a lightweight behavior-driven testing framework named "describe-it" for use within Postman, inspired by popular frameworks like Mocha and Jasmine. This tiny, 0.7kb minified script allows users to write organized tests with isolated assertions, enhancing the testing of API responses by mimicking the specification style of behavior-driven development (BDD). The framework includes functions such as `describe`, `it`, `beforeEach`, `afterEach`, and `expect`, which perform various testing and assertion tasks similar to those in Mocha and Jasmine. Users can save the script as a global variable within Postman, enabling reuse across multiple requests without manual addition, and integrate it into test scripts by evaluating the global variable. The author provides an example of using the framework to check for a 200 status code and HTML content type in API responses, demonstrating its functionality through nested describe blocks and sequential test execution, even in the presence of runtime errors.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.