Where to find Collection Name on.start

I have a custom reporter set up and I would like to be able to retrieve the name of the Postman collection being run by newman, in the on.start event from within the custom reporter. Is this possible and if so, how?

Thanks,
Jill

Hey Jill,

You could use either:

.on('beforeDone', function (err, arg) {
    console.log(arg.summary.collection.name);
});

.on('done', function (err, summary) {
    console.log(summary.collection.name);
})

The best way that I figure these things out is but just logging different parts of the events to the console and then expecting them to see what I can use.

.on('done', function (err, summary) {
    console.log(summary);
});

.on('done', function (err, summary) {
    console.log(summary.collection);
});

.on('done', function (err, summary) {
    console.log(summary.collection.name);
});

Normally, itโ€™s a bit long-winded just to get the answer but it helps me know whatโ€™s getting returned in the events :slight_smile:

Danny,

Thanks. Can I assume by your answer that there is no way of getting the Collection Name in the โ€œon.startโ€ event? To do what I wanted to do, I needed to access that information at the start of an iteration. I had actually created separate scripts to log all the args and summary content on every one of the events to files so that I can do a look up for when the information is available. I did find the summary.collection.name on the on.done event, however, that did not work with my current setup. At this point I am guessing I will need to redesign a few things.

Thanks for the response,
Jill