Let us take a deep dive into how to use setup postman bdd.
Note: It is assumed that user already have postman and newman installed on their machine along with their dependencies.
Installing Postman BDD
Installation is done triggering a Get request and setting the response as Global environment variable.
- Create a GET request to
- Set Global environment variable by using below command in test tab.
Once we trigger above get request, postman bdd will be available for use. We can make use of postman BDD features by below command
Postman bdd library provide us with flexibility to write tests and assertions using fluent asserts and have best features of Chai and Mocha. Inorder to demonstrate this, I am using sample Tutorial given with postman client.
Open up the sample Request in Postman Tutorial folder under collections. It will already have some test predefined in Test tab. Remove them and add below test to it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Note: You can find more details of various type of asserts in http://www.chaijs.com/api/bdd/
Once it is done, trigger the request