# Test APIs using the Postman VS Code extension Use the Postman VS Code extension to test your API's functionality. You can add pre-request and [post-response scripts](#test-your-api-using-scripts) to your HTTP collections, folders, and requests. You can also [open pre-request and post-response scripts as a JavaScript file](#edit-scripts-as-a-javascript-file), giving you the full editing experience of your code editor. You can [add common tests to your team's Postman Package Library](/docs/developer/vs-code-extension/tests-and-scripts/packages/) and reuse them in internal workspaces. ## Test your API using scripts 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: 1. Select an HTTP request, folder, or collection. To learn more about testing collections and folders, see [Test collections and folders](/docs/tests-and-scripts/write-scripts/test-scripts/#test-collections-and-folders). 2. Select **Scripts > Post-response** and add tests. You can add your own post-response scripts or snippets of commonly used test code. For test examples, see [Postman test script examples](/docs/tests-and-scripts/write-scripts/test-examples/). 3. Optionally, you can [add log statements to your post-response scripts](/docs/sending-requests/response-data/troubleshooting-api-requests/#using-log-statements) to help you debug your requests in [the Postman Console](/docs/developer/vs-code-extension/send-requests/#troubleshoot-with-the-postman-console). 4. 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](/docs/tests-and-scripts/write-scripts/test-scripts/). ## Edit scripts as a JavaScript file 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. 1. Open an HTTP request, folder, or collection you'd like to add tests or scripts to. 2. Click the **Scripts** tab, and then select the **Pre-request** or **Post-response** tab. 3. Click Open web icon **Open in native editor** in the upper right of the code editor. A JavaScript file opens in a new tab. 4. Write and edit your test and scripts in the file. Changes to the file are synced to your script in real time. 5. Save the file to preserve your changes.