Module that unifies execution of third-party JavaScript within Node.js and Browser.
This module is part of Postman Runtime Core and is not intended for independent use.
If you are looking to execute collections, you should bee using Newman
var Sandbox = require('postman-sandbox'),
context;
Sandbox.createContext(function (err, ctx) {
if (err) {
return console.error(err);
}
ctx.execute(`// code here`, {}, {}, function (err) {
if (err) {
return console.error(err);
}
console.log('executed')
});
});
The following section outlines the API available inside sandbox scripts
- pm.globals
- pm.environment
- pm.collectionVariables
- pm.test
- pm.request
- pm.request
- pm.response
- pong
- error
- console
- execution
- execution.error
- execution.error.*
- execution.request.*
- execution.result.*
- execution.cookies.*
- execution.skipRequest.*
- ping
- execute
- execution.abort.*
- execution.response.*
- execution.cookies.*
To debug tests in Chrome's DevTools, start tests using npm run test-browser -- --debug
and click DEBUG
.