Intro to ScriptsPostman is not only used for manual testing, but we can also do automation testing of API. Postman requests and collections can be applied to dynamic behavior. In Postman Scripts are the lines of code that allow you to automate an API test. It offers you to write pre-request and test scripts.
In Postman, we can write the tests, pass the data between the requests, and change the parameters. It allows adding test script and pre-request script to a collection, a folder, a request, or a request not attached to a group. Postman SandboxTo write the script in Postman, we use Postman Sandbox. Postman sandbox has been written in Javascript. It is an execution environment. Since the sandbox has written in Javascript, therefore, it will only receive a script written in Javascript. Hence, we have to write the script in javascript to make the code executable in Postman. Execution Order of Scripts in PostmanIn Postman, the order of script execution for a single request is as follows:
The order of script execution for every request in a collection is as follows:
The scripts should always run according to the following hierarchy for every request in a collection:
The same order will be applied for both pre-request and test scripts.
Next TopicPre-request Scripts
|