Schedule postman collection run in Node.js
Postman helps us to write and automate API tests. We can create collections which are group of API requests. Newman is a command-line Collection Runner for Postman. It enables you to run and test a Postman Collection directly from the command line
Postman provides Monitoring service which is a way to stay up to date on the health and performance of your APIs. Postman monitors are based on collections. Monitors will run through each request in your collection, similar to the collection runner. The free plan of Postman monitor has limitation on API execution per month.
What if you would like to run your postman collections multiple times a day which is more than the limit Postman monitoring service provides? You can switch to Node.js library node-cron
following are libraries required for this task in your package.json
create a runner.js file
You can choose the reporters to reporters: [“cli”] if you would like to see the results in command line.
node runner.js will execute tests every 5 minutes and generates an HTML report.