postman's notebooks

  • newman api usage example - find unique url - /postman/newman-api-example-find-unique-url
    Last edited 7 years ago
    var newman = require('newman'), collectionUrl = "https://raw.githubusercontent.com/postmanlabs/newman/develop/examples/sample-collection.json", uniqueUrls = {}; // here we will maintain the unique URLs // call newman.run to pass `options` object and listen to events newman.run({ collection: collectionUrl }) .on('request', function (err, args) { if (err) { return; } var url = args.request.url.toString(); // store unique URLs and the count of times they were // requested. uniqueUrls[url] ? (uniqueUrls[url] += 1) : (uniqueUrls[url] = 1); }) .once('done', await function (err) { console.log("List of unique URLs in this collection:"); // list all unique URLs Object.keys(uniqueUrls).forEach(function (url) { console.log(`${uniqueUrls[url]} occurrence(s): ${url}`); }); });
  • newman run summary object - /postman/newman-run-summary-object-sample
    Last edited 7 years ago - from: https://tonicdev.com/npm/newman
    var newman = require("newman") newman.run({ collection: "https://www.getpostman.com/collections/631643-f695cab7-6878-eb55-7943-ad88e1ccfd65-JsLv" }, await function (err, summary) { console.log(summary); });