Error message not being displayed when running a Collection with a data file


#1

When I run my script as a collection using a data file, I’m not getting the specifics of the error message when a test fails. I do get that error details printed out in the the app if I was running it as a standalone using env variables for a single run rather than a data file for multiple runs.

For e.g I have the following in my script :

pm.test(“Check that product name is not null”, function() {

for (i = 0; i < d.length; i++) {

pm.expect(d[i].slugs.product.name, “reason for failure is foo for “ + d[i].title ).to.not.be.null;

pm.expect(d[i].slugs.product.name, “reason for failure is foo for “ + d[i].title ”).to.not.be.empty;

}

});

If I run that in the postman app (with just one value and thus no data file) and the test fails, then the message ‘reason for failure is foo’ that’s in the pm.expect statement get printed out.

But if I run it as a Collection with a data file, I just get

“Check that product name is not null” failed

My d[i] array can be very big, so I need to know which row it failed for thus I need to know d[i].title’s value.

Right now I can’t see that value when I run it as part of a Collection with a data file.

See attached screenshot, where you can compare the error message printed out by the Runner as opposed to the error message printed out when I run the script as a standalone for one run. Compare the 2 circles marked out in red.
(Please ignore the left half of the screenshot, looks like I forgot to cut out that part)

All the above applies when I run via command line newman as well.

Any thoughts ? Is there a way around this ?