Is it possible to refer to postman call name within the tests body

In https://www.getpostman.com/docs/postman/scripts/postman_sandbox - paragraph Request/response related properties you can use the 'request' object.

request.name: gives you the current test case name Obsolete use pm.info.requestName

request.method: gives you the method used (PUT, GET, etc.)

request.url: gives you the target url

In order to see all the available data you may use, I suggest you to open the console (View/Show postman console or Alt+Ctrl+C) and see the data returned by this: console.log(request)


Postman v6.5.2 and up uses pm.info.requestName

console.log("Running: "+ pm.info.requestName); 

Look at pm.info object:

https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#scripting-with-request-info

Tags:

Postman