15

i have a collection in postman contain a lot of requests is there any option in Newman to run specific requests from this collection rather than create new folder for the specific request and run

mahmoud rabie
  • 151
  • 1
  • 4
  • Here is an affiliated issue on the `newman`'s GitHub repo: https://github.com/postmanlabs/newman/issues/276 – tuomastik May 06 '20 at 13:40

3 Answers3

21

Yes, you can run a specific request in a collection runner in newman CLI with option --folder.

Documentation:

CLI option : --folder "name"

Run requests within a particular folder/folders or specific requests in a collection. Multiple folders or requests can be specified by using --folder multiple times, like so: --folder f1 --folder f2 --folder r1 --folder r2.

Example:

newman run "postman-collection-API" --environment "postman-environment-API" --folder request-name
Community
  • 1
  • 1
Hasna A.A
  • 311
  • 2
  • 4
2

You can also run specific requests in the newman library as follows:

Documentation:

options.folder - The name or ID of the folder/folders (ItemGroup) in the collection which would be run instead of the entire collection.

Example:

newman.run(
  { 
    collection: 'postman-collection-API',
    environment: 'postman-environment-API',
    folder: ['request-name', 'other-request-name']
  },
  function (error, summary) {
    console.log(`${summary.run.executions.length} requests were run`);
  }
);
Cameron Wilby
  • 2,222
  • 1
  • 25
  • 35
0

No, it is not possible to run a single request from a collection using newman. Refer newman command line options

Jeeva
  • 438
  • 4
  • 12