Hi chris,
I added the below function in BeanShellFunction.bshrc file.Please let me
know how and where I have to use this function.

Mahesh....

On 5/4/07, chris <[EMAIL PROTECTED]> wrote:

in your BeanShellFunction.bshrc file, you can define following method (i
use
it in my testplans and it works perfectly):

// generates a random string with length n
// string consists of number, uppercase letters and lowercase letters
String generateRandomString(int n) {
     char[] pw = new char[n];
     int c  = 'A';
     int  r1 = 0;
     for (int i=0; i < n; i++) {
       r1 = (int)(Math.random() * 3);
       switch(r1) {
         case 0: c = '0' +  (int)(Math.random() * 10); break;
         case 1: c = 'a' +  (int)(Math.random() * 26); break;
         case 2: c = 'A' +  (int)(Math.random() * 26); break;
       }
       pw[i] = (char)c;
     }
     return new String(pw);
}

call this function in your jmeter testplan with
${__BeanShell(generateRandomString(20))}

//chris




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to