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
Asked
Active
Viewed 8,800 times
15
-
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 Answers
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
-
Multiple `--folder` support appears to be a new addition to v4 BTW: https://stackoverflow.com/questions/52519415/how-to-read-two-folder-with-newman – Ciro Santilli OurBigBook.com Jun 15 '21 at 15:21
-
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