You are on page 1of 7

Run Postman collections through Windows Task Scheduler for every 1 minute

Pre-requisites:

1. Node js ( node package manager) should be installed in your machine link to download and
node js by clicking this following link for windows machine https://nodejs.org/en/#home-
downloadhead
2. Install postman tool from this postman website https://www.postman.com/downloads/
3. Follow this link to install newman globally (https://learning.postman.com/docs/running-
collections/using-newman-cli/command-line-integration-with-newman/ )
4. Follow this link to install htmlextra report https://www.npmjs.com/package/newman-
reporter-htmlextra

Sequence Diagram:

A postman collection is required to keep and windows batch file. So please find the below link step
by step details to create postman collection ( I will keep the below link in comments)

https://www.linkedin.com/posts/ganeshqa_create-and-run-postman-collections-via-newman-
activity-6746991648431050752-_ENs

Steps to create Windows batch file

Open a notepad file an type the below details

➢ Changing the directory where postman collections is present in your machine


➢ We are setting date and time
➢ Creating a log file with the name as test and the log file should print the message as Success
with timestamp details
➢ Newman command
➢ Save the file extension as .bat ( e.g. batchrun.bat )
Run the batch file to test by double clicking batchrun.bat to ensure batch file details are working
properly

Launched to command prompt and it got closed automatically after the run

After successful run htmlextra report is got generated in newman folder and log file is got created
date and time details.

Steps to schedule batch file in Windows Task Scheduler

1. Type task scheduler in search bar and click on it


2. Right click on the Task scheduler folder and click Create Task

3. Name the task as ‘Postman_batchrun’ and select the appropriate windows os details from
configure for dropdown
4. Navigate to Triggers tab and click New button and it will open New Trigger as below
5. Select the below trigger details based on your requirements and click ok

Begin the task: On a Schedule , One time , Repeat task every 1 minute ( its editable ) , duration 15
minutes, also we can select the schedule expiration if it required

Different Begin the task details


6. Navigate to Actions tab and click new and selection the batchrun.bat file which we created
in the document page no 2 and then click ok
7. After 15 minutes the scheduler job will get stop and verify the log file and htmlextra
reports

Real-time: We planned to run a collection which contains 15 different requests (


POST,GET,PUT,PATCH and DELETE) methods for every 5 minutes to find the performance of
downstream requests. We have taken all the response timings in azure portal. So Task scheduler
helped us to run for every 5 minutes on whole day.

You might also like