Paili
Paili

Reputation: 845

random number in every testrun | JMeter Webdriver

I have a script, which create a new user in every testrun with a random number as name. So the users are unique.

But when I start a testrun in Ultimate Thread Group with more than one user it use always the same random-number. Is it possible to create everytime a new one?

I tried to use propertys or reset a variable at the end, but it didn't worked.

Upvotes: 1

Views: 466

Answers (2)

Dmitri T
Dmitri T

Reputation: 168092

JMeter provides __UUID() function which generates unique GUID structure each time it's being called.

var username = '${__UUID}'

Upvotes: 2

silhouette hustler
silhouette hustler

Reputation: 1763

Why don't you use a unique date and time instead of a random number, it's much more reliable and helpful in some sense, than just a random number.

You could store something like this into a variable and use it for the name:

var uniqueDate = DateTime.Now.ToString("F").Replace(":", "-");

Upvotes: 2

Related Questions