Set requestName dynamically

How to dynamically set the name of a request appearing in the report?
This value can be accessed using pm.info.requestName.
I wish to update this value at runtime to create more meaningful reports either in combination with Data Variables or otherwise.

Any help is highly appreciated!

Hey @tejas.deshpande

Welcome to the community! :star:

Currently, there isn’t a way to programmatically set the Request Name in the app, that pm.* function would only get the name.

You mentioned reporting and data variables - Would you be able to expand on your current use case?

In the collection run, I wanted to programatically set the Request Name with the aid of scripting or data from external sources.

Similar BDD use case would be:
const tests = [ “Valid Login”, “Invalid Login” ]

tests.forEach(function(testName) {
  describe($testName, function() {
    assetSomething...
  }
}

Output would be similar to but not exactly…

âś“ Valid Login
âś“ assetSomething
âś“ Invalid Login
âś“ assetSomething

Are you trying to change the request name or the Test name within the request?

Issue is with modifying the Request Name. Test titles can already be updated dynamically since its defined in Javascript.

For reference: From the image below, I would like to update the Request Name Get assignments to Get assignments - {{Current_DateTime}} at runtime.

P.S. This is just a reference and the modification of Request Name at runtime can be for any other form/reason as well based on criteria.

Hope this helps. :slightly_smiling_face:

There isn’t a programmatic way of doing this in the app for the Request Name as you can’t add the variable syntax to the name but you could look at using Newman and creating a script to inject that into the JSON file before Collection is run or some other way of dynamically changing this.