Scripts in Postman
1. Scripts are a piece of code.
2. It allows to write tests, passing data between request and changing the value for parameters.
3. It can be added into the collection, folder and request
There are two places that we can write scripts.
1. Pre-requests scripts - it runs before the execution of request
2. Tests scripts - It will run after receiving the response from the server
The lifecycle for each request is in below
Pre-request script -> request ->response ->test script
When you start a collection run, all requests are run in the order you see them in Postman. So all requests are executed first, by order of the folder, and then any requests in the root of the collection.
Collection pre-request script ->Folder pre request script-> request pre request script -> Request -> Response -> collection test script -> folder test script -> request test script
you can use variables to pass values from one request to another, or one collection into another. They also have a hierarchy:
No comments:
Post a Comment