Page 1 of 1

A special unique number for each session

PostPosted: Wed Nov 02, 2011 1:50 pm
by blaineN
I need to have a special unique number for each session that I run in LoadTest mode...do you have a simple way to generate a unique identifier?

Re: A special unique number for each session

PostPosted: Thu Nov 03, 2011 12:44 pm
by eValid
blaineN wrote:I need to have a special unique number for each session that I run in LoadTest mode...do you have a simple way to generate a unique identifier?
There is a very simple way to do this that we use all the time: We simply use the current clock value measured to the nearest second.

OK, yes, theoretically it is not unique, but if you have a string like 2011.11.03.13.45.45 -- in other words, the current date to the nearest second, then that is unique enough "for all practical purposes."

You can get those values from the eValid Reserved Variables by adding them into your script as parameters. They look like this $_Year, $_Date, $_Hour, $_Minute, $_Second in your script, and the values that appear based on those parameters are picked up from your machine at the time you run your script. So they will be unique each time.

(The big assumption is that you don't have scripts starting more often than every 1 second...but in that case, we recommend a Delay 1001 command to make even that rare case impossible.)

eValid Scripting