I wanted to have the request name of my Postman collection in my newman report. So, I have added the following code to my script,
pm.test(`${request.name}: Status Assertion`, function () {
pm.response.to.have.status(401);
});
I get the request name correctly. However, I'm getting the following warning in the console,
When I use pm.request,
console.log('Request name: ',pm.request.name)
How do I get rid of the warning and have the name of the request?
Thanks in advance
This should be using pm.info.requestName
here instead.
You could also make use of the new pm.execution.location.current
function here.