Coder Social home page Coder Social logo

nareshnavinash / newman-run Goto Github PK

View Code? Open in Web Editor NEW
17.0 4.0 16.0 348 KB

Run multiple postman collections along with predefined configs using a single feed file. Reduces command-line arguments since reporting (allure, JSON, CLI, and HTML) is embedded internally.

Home Page: https://nareshnavinash.github.io/newman-run/

License: GNU General Public License v3.0

JavaScript 100.00%
postman newman runner newman-run npm npm-package api-automation

newman-run's Issues

Include request, response body and headers in allure report generated by newman-run

Hello, when we generate allure report we are not getting the request, response body and headers,
We have a working example for "newman run" at : https://github.com/dvargas46/newman-reporter-allure,
would be much helpful if we integrate the newman-reporter-allure module from above to the existing "newman-run"

I have a temporary fix for this now to install as follows:

cd /usr/lib/node_modules/newman-run/node_modules/
sudo mv newman-reporter-allure newman-reporter-allure-old
sudo npm install -g @danvargas46/newman-reporter-allure
sudo mv ../../@danvargas46/newman-reporter-allure .

If i update the newman-run to new version this gets updated to its default report.
Since we are getting request , response body and headers extra other than normal report, it would be much helpful if the same newman-reporter-allure module is pulled into this permanently.

@nareshnavinash Can we get some improvement around this ? Thanks.

Request for Globals to be included as an option in the feed file

I have a Postman API and Newman project consisting of multiple collections, environments and globals variables.
This package appears to be suitable for my project demand, which would be to execute multiple collections to generate one summary report.
However my test scripts utilise the globals variables and when using this package it does not recognise these, as I could not appear to find if the Globals could be included??
As it appears to only reference to collections and environment files.

Run should fail if an assertion fails

Since I'm running the script in a CI/CD environment I need to get feedback when some test fails, but I'm always getting exit 0, even when some assertion fails. I think it should fail with exit 1.

function (err, summary) { if (err || summary.run.error || summary.run.failures.length) { process.exit(1); } }

issues while running multiple collections using newman-run

hello Suresh, I have 10 collections with each one having its own environment files. I am runing thosee using feedfile.json

{
"runs" :[
{
"collection":"collection1.json",
"environment":"evn1.json",
"iterationData": "data.csv"

}

{
"collection":"collection2.json",
"environment":"evn2.json",
"iterationData": "data.csv"

}

]

}

newman-run -f feedfile.json

It is runing fine but 2 issues:
1- creating many cloned collection files inside the folder which is confusing every time I have to delete them manually.
2- It is creating separate html reports but I want a single report for all
any help?

Core.js returning an error when collection execution succeeded

I'm running latest newman-run version and when the collection execution succeeded we're getting this error pointing to the core.

#### Finished Execution ####

/Users/varaya/.nvm/versions/node/v14.6.0/lib/node_modules/newman-run/lib/core.js:69
                throw err;
                ^
null
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Error: Cannot find module '..\..\..\..\..\..\..\r1\a\https:\api.getpostman.com\collections\ae4f1c31-14a6-4438-8d7d-

HI all,

Any ideas on the above? I've taken out some of the GUID for security reasons but the whole collection url is appearing here. Here is out Newman command:

2021-06-01T10:26:14.4358201Z newman-run -c https://api.getpostman.com/collections/ae4f1c31-14a6-4438-8d7d-........................... -e https://api.getpostman.com/environments/8188685d-2a89-4bb7-ad75-.................... --working-dir C:\agent\_work\r1\a\repo\Solutions\ExposureAPI\TestFiles --reporters junit,htmlextra --reporter-junit-export Results\\junitReport.xml
2021-06-01T10:26:14.4791870Z ========================== Starting Command Output ===========================
2021-06-01T10:26:14.5041028Z ##[command]"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "C:\agent\_work\_temp\7e647a6d-2200-473e-94dc-774a07e24a11.cmd""
2021-06-01T10:26:16.6181784Z �[2J�[0f _   _                                                  ______               
2021-06-01T10:26:16.6182280Z | \ | |                                                 | ___ \              
2021-06-01T10:26:16.6182670Z |  \| |  ___ __      __ _ __ ___    __ _  _ __   ______ | |_/ / _   _  _ __  
2021-06-01T10:26:16.6183011Z | . ` | / _ \\ \ /\ / /| '_ ` _ \  / _` || '_ \ |______||    / | | | || '_ \ 
2021-06-01T10:26:16.6183351Z | |\  ||  __/ \ V  V / | | | | | || (_| || | | |        | |\ \ | |_| || | | |
2021-06-01T10:26:16.6183710Z \_| \_/ \___|  \_/\_/  |_| |_| |_| \__,_||_| |_|        \_| \_| \__,_||_| |_|
2021-06-01T10:26:16.6184051Z                                                                              
2021-06-01T10:26:16.6184405Z                                                                              
2021-06-01T10:26:16.6251506Z Collection file taken to run: https://api.getpostman.com/collections/ae4f1c31-14a6-4438-8d7d-.....................................................
2021-06-01T10:26:16.6252207Z Environment file taken to run: https://api.getpostman.com/environments/8188685d-2a89-4bb7-.....................................................................
2021-06-01T10:26:16.6311250Z node:internal/modules/cjs/loader:944
2021-06-01T10:26:16.6311745Z   throw err;
2021-06-01T10:26:16.6311927Z   ^
2021-06-01T10:26:16.6312010Z 
2021-06-01T10:26:16.6312445Z Error: Cannot find module '..\..\..\..\..\..\..\r1\a\https:\api.getpostman.com\collections\ae4f1c31-14a6-4438-8d7d............................................'
2021-06-01T10:26:16.6312917Z Require stack:
2021-06-01T10:26:16.6313184Z - C:\agent\_work\_tool\node\16.2.0\x64\node_modules\newman-run\lib\core.js
2021-06-01T10:26:16.6313543Z - C:\agent\_work\_tool\node\16.2.0\x64\node_modules\newman-run\bin\newman-run.js
2021-06-01T10:26:16.6313925Z     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
2021-06-01T10:26:16.6314450Z     at Function.Module._load (node:internal/modules/cjs/loader:774:27)
2021-06-01T10:26:16.6314927Z     at Module.require (node:internal/modules/cjs/loader:1013:19)
2021-06-01T10:26:16.6315288Z     at require (node:internal/modules/cjs/helpers:93:18)
2021-06-01T10:26:16.6315734Z     at NewmanConfig.runCollectionWithEnv (C:\agent\_work\_tool\node\16.2.0\x64\node_modules\newman-run\lib\core.js:55:25)
2021-06-01T10:26:16.6316272Z     at Object.<anonymous> (C:\agent\_work\_tool\node\16.2.0\x64\node_modules\newman-run\bin\newman-run.js:50:8)
2021-06-01T10:26:16.6318129Z     at Module._compile (node:internal/modules/cjs/loader:1109:14)
2021-06-01T10:26:16.6318504Z     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
2021-06-01T10:26:16.6318867Z     at Module.load (node:internal/modules/cjs/loader:989:32)
2021-06-01T10:26:16.6319222Z     at Function.Module._load (node:internal/modules/cjs/loader:829:14)
2021-06-01T10:26:16.6319622Z     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
2021-06-01T10:26:16.6319994Z     at node:internal/main/run_main_module:17:47 {
2021-06-01T10:26:16.6320254Z   code: 'MODULE_NOT_FOUND',
2021-06-01T10:26:16.6320471Z   requireStack: [
2021-06-01T10:26:16.6320772Z     'C:\\agent\\_work\\_tool\\node\\16.2.0\\x64\\node_modules\\newman-run\\lib\\core.js',
2021-06-01T10:26:16.6321707Z     'C:\\agent\\_work\\_tool\\node\\16.2.0\\x64\\node_modules\\newman-run\\bin\\newman-run.js'
2021-06-01T10:26:16.6322184Z   ]
2021-06-01T10:26:16.6322353Z }

Running collection request in-order

Hello, I tried to run the example wrote in the README.md file but I notice that the collection order were not followed at all.
But, the collection requests were executed in parallel by alternating requests coming from different collections.

Should it be possible handle the fixed order wrote in runs.json file?

Thanks.

newman-run -v must return newman-run version

newman-run -v

 _   _                                                  ______               
| \ | |                                                 | ___ \              
|  \| |  ___ __      __ _ __ ___    __ _  _ __   ______ | |_/ / _   _  _ __  
| . ` | / _ \\ \ /\ / /| '_ ` _ \  / _` || '_ \ |______||    / | | | || '_ \ 
| |\  ||  __/ \ V  V / | | | | | || (_| || | | |        | |\ \ | |_| || | | |
\_| \_/ \___|  \_/\_/  |_| |_| |_| \__,_||_| |_|        \_| \_| \__,_||_| |_|
                                                                             
                                                                             
Need either feed file (-f) or collections (-c) file to run the tests or atleast (-r) to remove the files from reports directory!!!

Usage: newman-run -f <feed_file_path>

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  -f, --feed         Feed file path                                     [string]
  -c, --collection   Collection file path file path                     [string]
  -e, --environment  Environment file path file path                    [string]
  -r, --remove       To remove the files from reporting directory

Argument check failed: argv => { if(argv.f == undefined && argv.c == undefined && argv.r == undefined) { console.log(file_error_message); return false } else { return true }}

Illegal characters in path stopping output being produced

using 1.2.4 newman-run and running command
newman-run -f feed.json where feed.json is like

{
	"runs": [
		{
			"collection": "./collections/Call.postman_collection.json",
			"environment": "./environment/qa.postman_environment.json"
		}
	]
}

I get the following error

C:\npm\prefix\node_modules\newman-run\node_modules\mkdirp\lib\path-arg.js:20
     throw Object.assign(new Error('Illegal characters in path.'), {
      ^

Error: Illegal characters in path.
    at pathArg (C:\npm\prefix\node_modules\newman-run\node_modules\mkdirp\lib\path-arg.js:20:27)
    at mkdirp (C:\npm\prefix\node_modules\newman-run\node_modules\mkdirp\index.js:10:10)
    at C:\npm\prefix\node_modules\newman-run\node_modules\newman\lib\run\export-file.js:97:17
    at nextTask (C:\npm\prefix\node_modules\newman-run\node_modules\async\dist\async.js:5787:13)
    at Object.waterfall (C:\npm\prefix\node_modules\newman-run\node_modules\async\dist\async.js:5798:9)
    at Object.awaitable [as waterfall] (C:\npm\prefix\node_modules\newman-run\node_modules\async\dist\async.js:211:32)
    at module.exports (C:\npm\prefix\node_modules\newman-run\node_modules\newman\lib\run\export-file.js:95:15)
    at C:\npm\prefix\node_modules\newman-run\node_modules\async\internal\withoutIndex.js:8:40
    at eachOfArrayLike (C:\npm\prefix\node_modules\newman-run\node_modules\async\eachOf.js:61:9)
    at eachOf (C:\npm\prefix\node_modules\newman-run\node_modules\async\eachOf.js:181:12)
    at awaitable (C:\npm\prefix\node_modules\newman-run\node_modules\async\internal\awaitify.js:13:28)
    at eachLimit (C:\npm\prefix\node_modules\newman-run\node_modules\async\each.js:125:31)
    at awaitable (C:\npm\prefix\node_modules\newman-run\node_modules\async\internal\awaitify.js:13:28)
    at done (C:\npm\prefix\node_modules\newman-run\node_modules\newman\lib\run\index.js:343:21)
    at C:\npm\prefix\node_modules\newman-run\node_modules\postman-runtime\lib\backpack\index.js:58:34
    at PostmanCollectionRun._process (C:\npm\prefix\node_modules\newman-run\node_modules\postman-runtime\lib\runner\run.js:160:13) {
  path: 'D:\\a\\1\\s\\reports\\json\\D:\\a\\1\\s\\collections',
  code: 'EINVAL'

code breaks if one collection completed the execution

code breaks if one collection completed the execution.
┌─────────────────────────┬─────────────────────┬────────────────────┐
│ │ executed │ failed │
├─────────────────────────┼─────────────────────┼────────────────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│ requests │ 23 │ 0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│ test-scripts │ 62 │ 0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│ prerequest-scripts │ 39 │ 0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│ assertions │ 61 │ 0 │
├─────────────────────────┴─────────────────────┴────────────────────┤
│ total run duration: 35.7s │
├────────────────────────────────────────────────────────────────────┤
│ total data received: 4.54KB (approx) │
├────────────────────────────────────────────────────────────────────┤
│ average response time: 1457ms [min: 508ms, max: 2.5s, s.d.: 714ms] │
└────────────────────────────────────────────────────────────────────┘

Finished Execution

C:\Users**********\AppData\Roaming\npm\node_modules\newman-run\lib\core.js:105
throw err;
^
null
(Use node --trace-uncaught ... to show where the exception was thrown)

Cannot run multiple collection with url on mac


| \ | | | ___ \
| | | ___ __ __ _ __ ___ __ _ _ __ ______ | |/ / _ _ _ __
| . | / _ \\ \ /\ / /| '_ _ \ / ` || ' \ |
|| / | | | || ' \
| |\ || __/ \ V V / | | | | | || (
| || | | | | |\ \ | |
| || | | |
_| _/ _
| _/_/ || || || _,||| || _| _| _,||| |_|

Feed file taken is: /Jenkins/poc_newman/all_collection.json
!----------------------------------Files Taken to run---------------------------------------!
{
collection: 'https://www.getpostman.com/collections/57c3cfef239jeijw39d93'
}
Collection file taken to run: https://www.getpostman.com/collections/57c3cfef239jeijw39d93
node:internal/modules/cjs/loader:1051
throw err;
^

Error: Cannot find module '../../../../../../Users/user/Documents/https:/www.getpostman.com/collections/57c3cfef239jeijw39d93'
Require stack:

  • /opt/homebrew/lib/node_modules/newman-run/lib/core.js
  • /opt/homebrew/lib/node_modules/newman-run/bin/newman-run.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at NewmanConfig.runCollection (/opt/homebrew/lib/node_modules/newman-run/lib/core.js:93:25)
    at /opt/homebrew/lib/node_modules/newman-run/lib/core.js:30:22
    at Array.map ()
    at NewmanConfig.looprun (/opt/homebrew/lib/node_modules/newman-run/lib/core.js:27:18)
    at Object. (/opt/homebrew/lib/node_modules/newman-run/bin/newman-run.js:46:8)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/opt/homebrew/lib/node_modules/newman-run/lib/core.js',
    '/opt/homebrew/lib/node_modules/newman-run/bin/newman-run.js'
    ]
    }

Node.js v20.5.1

Docker container

Great tool! Could you possibly build and publish this tool as a docker container and publish it on dockerhub? Would probably expand the user base

npm run serve-allure return missing script: serve-allure

npm run serve-allure
npm ERR! missing script: serve-allure

npm ERR! A complete log of this run can be found in:
npm ERR!     \npm-cache\_logs\2021-01-15T21_38_46_285Z-debug.log


0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\NVM\\v12.18.3\\node.exe',
1 verbose cli   'C:\\NVM\\v12.18.3\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'serve-allure'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: serve-allure
4 verbose stack     at run (C:\NVM\v12.18.3\node_modules\npm\lib\run-script.js:155:19)
4 verbose stack     at C:\NVM\v12.18.3\node_modules\npm\lib\run-script.js:63:5
4 verbose stack     at C:\NVM\v12.18.3\node_modules\npm\node_modules\read-package-json\read-json.js:116:5
4 verbose stack     at C:\NVM\v12.18.3\node_modules\npm\node_modules\read-package-json\read-json.js:436:5
4 verbose stack     at checkBinReferences_ (C:\NVM\v12.18.3\node_modules\npm\node_modules\read-package-json\read-json.js:391:45)
4 verbose stack     at final (C:\NVM\v12.18.3\node_modules\npm\node_modules\read-package-json\read-json.js:434:3)
4 verbose stack     at then (C:\NVM\v12.18.3\node_modules\npm\node_modules\read-package-json\read-json.js:161:5)
4 verbose stack     at C:\NVM\v12.18.3\node_modules\npm\node_modules\read-package-json\read-json.js:382:12
4 verbose stack     at C:\NVM\v12.18.3\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:123:16
4 verbose stack     at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
5 verbose cwd 
6 verbose Windows_NT 10.0.19041
7 verbose argv "C:\\NVM\\v12.18.3\\node.exe" "C:\\NVM\\v12.18.3\\node_modules\\npm\\bin\\npm-cli.js" "run" "serve-allure"
8 verbose node v12.18.3
9 verbose npm  v6.14.6
10 error missing script: serve-allure
11 verbose exit [ 1, true ]


ignore certificates while running with newman-run

how can I ignore certificates while running with newman-run? For newman it was the --insecure flag. However, this does not work for newman-ran. Can you help?

I am using the below command,
newman-run -f feed_file.json --insecure

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.