Use the Postman VS Code extension to test your API's functionality. You can add pre-request and post-response scripts to your HTTP collections, folders, and requests. You can also open pre-request and post-response scripts as a JavaScript file, giving you the full editing experience of your code editor.
You can also add common tests to your team's Package Library and reuse them in internal workspaces.
You can add post-response scripts to HTTP collections, folders, and requests that run after a response is received. Add tests to confirm that your API is working as expected, and help you debug your API if something goes wrong. Postman supports post-response scripts written in JavaScript.
To add post-response scripts, do the following:
Select an HTTP request, folder, or collection you'd like to add tests to.
To learn more about testing collections and folders, see Test collections and folders.
Select Scripts > Post-response, and add your tests. You can add your own post-response scripts or snippets of commonly used test code. For test examples, see Postman test script examples.
Optionally, you can add log statements to your post-response scripts to help you debug your requests in the Postman Console.
Click Send to run your request.
The tests run after a response is received. In the Response section, click the Test Results tab to review the results of your tests.
To learn more about writing tests scripts in Postman, see Write scripts to test API response data in Postman.
You can open pre-request and post-response scripts as a JavaScript file in the application you're using to develop your APIs. Get the full editing experience of your code editor while you write test and scripts for your HTTP requests, folders, and collections. This also enables you to leverage your application's AI agent, such as GitHub Copilot, to help you write and edit your tests and scripts.
Last modified: 2025/07/25