Dynamic Variables like firstName for Switzerland

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

How to set dynamic variable for certain region like switzerland that I get common firstname and lastnames like Rudolf Müller for example.

Thanks you in advance.

2 Likes

Hi @frosch31,

Yes, this seems an interesting ask :blush: May be you can raise a feature request to customize the Dynamic variables options in Postman.

Meanwhile as a workaround for your use case,

  1. You can create an array with common first/last names and try to pick the random ones from it. Sorry I am just throwing this suggestion without knowing much about your setup/scenarios. Something like,
var names = ["Rudolf", "Müller", "Danièle","Märta","Adélie"];

pm.environment.set('Names', names);

pm.environment.set("name", names[Math.floor(Math.random() * names.length)]);

and you can use the variable inside the body,

"firstName": "{{name}}"

If you need too many names, you can try Data driven approach. Create an CSV or JSON and try to read data from that :grinning:

  1. Else if you are not aware of “Mockaroo” tool, please give it a try. You have the option to generate the European first names.

If you are new to “Mockaroo”, I have written a article about Mockaroo and how to integrate that with Postman. Read this if needed :blush:(How to create realistic bulk data for Tests? | by Pricilla Bilavendran | Medium)

I hope these are useful :innocent:

Let me know if you have any questions :slightly_smiling_face:

4 Likes