Postman newman - execute multiple tests but use excel data for specific tests


I am using Postman enterprise 7.18.1 with newman. I have scheduled the automation job using Jenkins. Here is my scenario:

  1. There are 500 tests executed sequentially
  2. I would like to use .csv/excel for say 100 tests as the patterns are same except the product code which I am planning to populate via EXCEL sheet (data driven). That means the entire suite will be executed “N” times. “N” is number of rows in the CSV file. The product code will be replaced from the excel sheet to the service call (for the first 100 tests)
  3. However I do not want to repeat the tests 101-500 “N” times as they are different . Execute tests 1-100 N times but execute tests 101-500 only once
  4. I do not want to create multiple jenkins jobs

Please suggest best way to handle this scenario.



I would like to follow up on this. Postman team suggested to use folders. That worked really well for the above scenario. I have separate folders for each feature. Some folders reads data from the CSV file, other folders do not use data file. Data file is specified at the folder level. Each folder uses different data file.

Now the challenge is each folder creates junit report separately when executing using newman. Same thing is happening with Jenkins execution.
I would like to get consolidated report instead of each folder creating separate report.

Requirement: some tests uses data file some do not. Is there a better way to get consolidated report?. Folders are working fine for this requirement. However it creates separate test report.
Appreciate your input.

Here are the details:

Command line execution - Works fine. No issues

newman run collections/tests.json --folder setup -e newenvstage.json --reporter-junit-export results1.xml --reporters cli,junit
newman run collections/tests.json --folder folder2 -e newenvstage.json --reporter-junit-export results2.xml --reporters cli,junit
newman run collections/tests.json --folder folder3 -e newenvstage.json -d data/data.csv --reporter-junit-export results3.xml --reporters cli,junit
newman run collections/tests.json --folder foler4 -e newenvstage.json --reporter-junit-export results4.xml --reporters cli,junit
newman run collections/tests.json --folder folder5 -e newenvstage.json -d data/data.csv --reporter-junit-export results5.xml --reporters cli,junit
newman run collections/tests.json --folder folder6 -e newenvstage.json --reporter-junit-export result6.xml --reporters cli,junit
newman run collections/tests.json --folder folder7 -e newenvstage.json --reporter-junit-export results7.xml --reporters cli,junit
newman run collections/tests.json --folder folder8 -e newenvstage.json --reporter-junit-export results8.xml --reporters cli,junit

Here is my package.json to run the tests via Jenkins (pasted partially)

“name”: "nxxxxx,
“version”: “1.0.0”,
“description”: “yyyy Project for Postman tests”,
“scripts”: {
“api-tests-stage1”: “newman run collections/tests.json --folder setup -e collections/stage_Env.json --export-environment newenvstage.json --reporter-junit-export results1.xml --reporters cli,junit”,
“api-tests-stage2”: “newman run collections/tests.json --folder folder2 -d data/testdata.csv -e newenvstage.json --reporter-junit-export results2.xml --reporters cli,junit”,
“api-tests-stage3”: “newman run collections/tests.json --folder folder3 -e newenvstage.json --reporter-junit-export results3.xml --reporters cli,junit”

Here is the Jenkins execute shell step:

npm run api-tests-stage1
npm run api-tests-stage2
npm run api-tests-stage3