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 ?