1

I am running batch of collections via newman out of which few are failing due to assertion error. So I expect jenkins job to have unstable status at the end because of assertion failures but instead jenkins job is throwing success status.

How can I update Jenkins status to provide unstable status if any collection fails due to assertion error.

Sjain
  • 69
  • 1
  • 13

1 Answers1

1

Not sure how you implemented your job but when I configured Jenkins it worked as expected. In your Jenkins job use Execute shell build step with following command:

newman run test.postman_collection.json

Newman will return 0 exit code on success and job will be green. On failure exit code will be 1 and job will fail.

bhusak
  • 1,320
  • 1
  • 9
  • 19
  • i did in the similar fashion except that I am running multiple collections sequentially via powershell script. and out of those multple collections - few are failing due to assertion error but resulting in jenkins success status. – Sjain Apr 23 '19 at 15:41
  • hmm, i think the issue is not with newman, but powershell script executing on jenkins. never ran powershell script in job, but from what i can see you need to configure powershell script execution on jenkins. take a look at this https://stackoverflow.com/questions/34349333/jenkins-powershell-plugin-always-builds-successfully – bhusak Apr 23 '19 at 17:42
  • 1
    Thank you for the link. It helped me to proceed further and I could implement a solution to achieve what i need. – Sjain Apr 25 '19 at 07:51