Subscribe Join 180,000+ subscribers and receive articles from our blog about software quality, testing, QA and security. Subscribe

Getting error when integrating with Newman and Postman

Hi,

I have recently integrated Testrail with postman using Newman and after running the CMD command I am getting below error,

C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman-reporter-testrail\node_modules\http-response-object\lib\index.js:51
throw err;
^

Error: Server responded to https://alogic.testrail.io//index.php?/api/v2/get_suite/565 with status code 401:
{“error”:“Authentication failed: invalid or missing user/password or session cookie.”}
at Response.getBody (C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman-reporter-testrail\node_modules\http-response-object\lib\index.js:41:23)
at TestRailReporter.pushToTestrail (C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman-reporter-testrail\lib\TestrailReporter.js:209:64)
at TestRailReporter.onComplete (C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman-reporter-testrail\lib\TestrailReporter.js:38:12)
at EventEmitter. (C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman-reporter-testrail\lib\TestrailReporter.js:7:12)
at EventEmitter.emit (C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman\node_modules\eventemitter3\index.js:203:33)
at done (C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman\lib\run\index.js:293:29)
at C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\backpack\index.js:58:34
at PostmanCollectionRun._process (C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:163:13)
at PostmanCollectionRun. (C:\Users\Siddharth Bameta\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:169:76)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
statusCode: 401,
headers: {
date: ‘Fri, 14 Aug 2020 02:10:40 GMT’,
‘content-type’: ‘application/json; charset=utf-8’,
‘content-length’: ‘87’,
connection: ‘close’,
server: ‘Apache’,
‘set-cookie’: [
‘tr_session=a3a9f8af-9849-4def-9a0d-eeb2efea3471; path=/; samesite=none; secure; HttpOnly’,
‘notificationbar=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/index’
]
},
body: <Buffer 7b 22 65 72 72 6f 72 22 3a 22 41 75 74 68 65 6e 74 69 63 61 74 69 6f 6e 20 66 61 69 6c 65 64 3a 20 69 6e 76 61 6c 69 64 20 6f 72 20 6d 69 73 73 69 6e … 37 more bytes>,
url: ‘https://alogic.testrail.io//index.php?/api/v2/get_suite/565
}

Any idea how to resolve this out?

The first usual question:
Did you configure Newman correctly, especially the user and password?

E.g. following this:

Hi Kwirth,

Issue resolved now, this was due to variable not defined correctly.

Thanks