- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are Scripts In Postman?
Postman is developed on Node.js that gives dynamic characteristics to Collections and requests. We can create test suites, execute requests having changing parameters, send data in between requests, and so on.
Let us send a GET request along with Pre-Request and Test scripts.
Pre-Request Script −
console.log("Tutorialspoint - Postman")
console.warn("Warning message in console") console.log("Logging message in console") console.info("Info message in console") console.error("Error message in console")
Add an URL in the address bar and send a GET request. In the below image, the Postman Console Output displays the message from the Pre-Request script printed before the execution of the GET request. Then the GET request got executed, finally the script that has been added as a part of Test scripts got printed.
Execution order for scripts in Collection
A Pre-Request script added to a Collection shall execute prior to all the requests in that Collection.
A Pre-Request script added to a folder shall execute prior to all the requests in that folder.
A Test script added to a Collection shall execute post execution of all the requests in that Collection.
A Test script added to a folder shall execute post execution of all the requests in that folder.
- Related Articles
- What is Pre Requests scripts in Postman?
- What are Sessions in Postman?
- What are Snippets in Postman?
- What are Postman Monitors?
- What are Local Scope Variables in Postman?
- What are the different startup scripts in JShell in Java 9?
- What are uncide scripts with respect to Tensorflow and Python?
- What are different Parameters available in Newman using Postman?
- What is Newman in Postman?
- What is Postman Sandbox?
- What is Postman Console?
- What is API Documentation in Postman?
- Using Shebang #! in Linux Scripts
- What is an Environment Variable in Postman?