Iām using Jenkins to run Newman. In order for the job to finish without exiting in the middle due to a failure, Iām running newman in a try-catch in bash as the following example:
newman run collection.json || rc=$?; echo $rc; failure=true
The problem is, that even when there are no failures in newman, it still gets a 1 return code. So in my job, the following command:
newman run collection.json --reporters cli,htmlextra,junit --reporter-htmlextra-export html/repot.html --reporter-htmlextra-logs --reporter-htmlextra-title Report-API --reporter-junit-export newman/report.xml -g newman/workspace.postman_globals.json -e newman/Master.postman_environment.json || rc=$?;if [[ $rc != 0 ]]; then echo $rc; echo "^ Return Code ^";echo "$file failed";failure=true;fi
Returned the following:
āāāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāā
ā ā executed ā failed ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāā¤
ā iterations ā 1 ā 0 ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāā¤
ā requests ā 9 ā 0 ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāā¤
ā test-scripts ā 18 ā 0 ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāā¤
ā prerequest-scripts ā 11 ā 0 ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāā¤
ā assertions ā 16 ā 0 ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāāāāāā¤
ā total run duration: 4.2s ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā total data received: 35.17kB (approx) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā average response time: 372ms [min: 158ms, max: 793ms, s.d.: 191ms] ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
1
^ Return Code ^
As you can see, even though in the run there were 0 failures, Newman still returns a 1 return code.
Am I missing something? Is this a Newman issue or a Bash issue?
Thanks ahead!