Required to run multiple collection through Newman

Is there any command to execute multiple collections through single cmd.
If you have please share it with me. I’m working on a large size project, so for me, it’s not possible to maintain all APIs in a single collection.

Can you explain why you need to run them in a single command? Why can you not run multiple commands?

@allen.helton Yes i can, but i divided my whole project into module and sub-module, i consider Module as a Collection and Sub-Module as a folder under the collection.
So in my project i required approx 15 to 20 collection.
So if need to run complete project i need to hit 15-20 times. i think it’s not good for usability .
one more thing is my collection is also depends on each other so i want to execute my complete project through single command, if you have any idea please share with me.

If i’m running its individually newman generate a individual report for each collection.
and i want single report for my project.
So please help me if you have any idea about it.

If you want the single report from newman, I can’t think of a way to accomplish what you are trying to solve. If you are fine with multiple reports, just executing newman for each collection would have been the route to go.

If you have postman pro or higher, you could write a script that uses the API to give you all the collections in a workspace. You could then iterate over each collection from the response and run newman for each one. That way your test runner would always be up to date when you add or remove collections.

@ramvishwakarma We run multiple collections daily through newman. We wrote a testrunner in node.js that calls newman as a function. We also defined environment files which have a list of all the collections we want to run in it so when we declare ‘testrunner.js’ it runs all the collections we have defined in our environment file.

Example of how we are calling newman:

function testRunner(collection, callback) {
    const reportOutput = path.join(reportsDirectory, collection.name + '.xml');
    //call newman.run to pass `options` object and wait for callback
    getIterationData(collection);
    newman.run({
       collection: require(collection.filePath),
       environment: configData,
       reporters: ['cli', 'junit'],
       reporter: { junit: { export: reportOutput } }
    }, function (err, summary) {
      if (err) {
        throw err;
    }
     console.log('collection run complete!');
     callback(summary);
  });

};

Thank you for your email.

Now it’s working for me and for your information, I’ve recently started it. your code helps me a lot but still, I’m facing one problem is that, its save the output report in .xml format I want it in html format like below cmd output:

newman run ForesightCollections.postman_collection4Feb.json -k -e KIBA.postman_environment4Feb.json -r htmlextra --reporter-htmlextra-title “Rakuten APIs Report”

I resolved this problem at my own level.

Hello,

The below value is not set in the header when I’m running a JSON file through node js.

User-Agent
PostmanRuntime/7.21.0
Accept
/
Cache-Control
no-cache
Postman-Token
8048118f-22fe-4ee9-bfa9-e9e2e0452328
Host
stg-fos.rmb-ss.jp
Accept-Encoding
gzip, deflate
Content-Length
129
Connection
keep-alive

please help me to solve this issue.

when I’m running the same JSON file through bellow cmd, it’s working fine.

newman run AForesightCommonModules.postman_collection.json -k -e KIBA.postman_environment.json -r htmlextra --reporter-htmlextra-title “Rakuten APIs Report”

Could you please help.

Hmm. I’m not sure. Are you passing the header in a variable/data file? It doesn’t look like it as part of your cmd line.

above value postman automatically add when i’m running through above mentioned cmd. but the same JSOP file when i’m running through NODE JS runner. It got failed.