Running multiple requests in parallel via Postman Newman to load test the API

InspiredBy picture InspiredBy · Oct 24, 2019 · Viewed 7.5k times · Source

I'm not a Node.js developer but I installed Newman Postman just to be able to load test my API.

I want to take advantage of a simple idea suggested at the link below to run multiple API requests in parallel from a batch file. Source: https://community.getpostman.com/t/how-can-i-run-simultaneous-request-parallely/3797/2

Due to my lack of knowledge of Node.js console commands, I'm failing at running the script file. What's the right syntax to run this batch/text file with a list of Postman collections?

I tried:

As a developer at the link above suggested I created myfile.txt file and plugged in:

newman run c:\path...\collection.json -e c:\path...\staging.json &
newman run c:\path...\collection.json -e c:\path...\staging.json &
newman run c:\path...\collection.json -e c:\path...\staging.json

Then I ran the file with:

newman run c:\path...\myfile.txt

Fail.

Then tried running the file this way:

node c:\path...\myfile.txt

No luck. Then I tried added #!/bin/bash inside of the file and running the same way but with .sh extension. Still no luck.

How can I run my simultaneous api calls from the file here ?

Answer

Dmitri T picture Dmitri T · Oct 24, 2019
  1. The recommendations from the article you're referring are about Bash, I don't know why you're talking about Node.js.
  2. The recommendations from the article are all for sequential execution of multiple tests
  3. You don't be able to apply any of these instructions because looking into c:\ drive you seem to be using a Windows OS

If you want to kick off several parallel version of newman process (whatever it is) in a Windows cmd.exe interpreter it makes sense to use start command like:

  1. Create file myfile.cmd
  2. Put the following lines there:

    start newman run c:\path...\collection.json -e c:\path...\staging.json 
    start newman run c:\path...\collection.json -e c:\path...\staging.json 
    start newman run c:\path...\collection.json -e c:\path...\staging.json
    

However I would rather recommend going for a specialized load testing tool, there is a variety of free and open source load testing solutions which don't have any problems with parallel API tests execution and at the end of test you will get nice tables and charts as I fail to see how you're going to analyze the results of your "load test" with Postman/newman.