Search code examples
continuous-integrationpostmanintegration-testingnewman

How to check if Newman tests fails programmatically?


I run postman tests on CI/CD and I need to check whether all tests were successfully passed. I find in the Newman Docs: Newman, by default, exits with a status code of 0 if everything runs well, such as without any exceptions.

If I correctly understand, this code signals, that all tests were passed? And how I can get this status code programmatically with any console tool?


Solution

  •   $argument = "run collection.json -e environment.json -k -r cli, htmlextra"
      $process = start-process newman -ArgumentList $argument -PassThru -Wait
     $process.ExitCode
    

    Use start process