After run collection with powershell/Newman, can we parse error

Is there any way that after run the collection with Powershell/Newman and parse(take just that part) the error part and save at another file?

I am running my test collection in azure pipeline, for that I used newman scripts. But now I need to extract errors and create API calls for each error line. For the first step, I was planning to extract every error end of the automation test. After extracting that (maybe in another file), I plan to read each error and call API after each line.

newman run "collection_name.postman_collection.json" --environment "DEV.postman_environment.json" => probably I need to add something for extract just errors

Hey @greenridinghood :wave:

Might not be what you’re looking for but you can use Newman as a library, to access the run summary object.

You can use the different on events to access part of the data like the error messages:

A basic example script:

const newman = require('newman');

newman.run({
    collection: require('collection.json')
}).on('assertion', function (err, args) {
    console.log(args.error.message);
})

When run it pushed the failed messages to the console but you could point it to some place else and not the console.

Might not be what you’re looking for but that’s one of the ways to access the run data when using Newman.