jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajan gupta <rajangupta...@gmail.com>
Subject Setting random string in a text field
Date Thu, 26 Jan 2012 03:45:48 GMT
Hi

I need to set a field with a random string. How can I tell JMeter to put
the random string in a field instead of a static value.
Please let me know.

I have a function which generates random string as shown below.

function randomString() {
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
    var string_length = 8;
    var randomstring = '';
    for (var i=0; i<string_length; i++) {
        var rnum = Math.floor(Math.random() * chars.length);
        randomstring += chars.substring(rnum,rnum+1);
    }
    return randomstring;
}

Thanks
Rajan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message