25

I have tried:

${__ RandomString (qwerty,"@",".com") }  

but it is not fine. I wonder how can I create this type of random email addresses? I haven't added anything in the Random Variable because I am not sure that I need to use it.

Luke
  • 11,426
  • 43
  • 60
  • 69
godRA66
  • 357
  • 1
  • 3
  • 7

2 Answers2

60

As per Using JMeter Functions guide __RandomString() function takes 3 parameters:

  1. Length of the desired random string
  2. Source characters
  3. If you need to store generated string into a JMeter variable you can provide variable name as 3rd argument.

So to get line of 10 alphabet characters you can use __RandomString function as follows:

${__RandomString(10,abcdefghijklmnopqrstuvwxyz,)}
Roy Shmuli
  • 4,979
  • 1
  • 24
  • 38
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
7

mail format:

RandomString(COUNT_OF_CHARS,LIST_OF_CHARS,) + '@' + RandomString(COUNT_OF_CHARS,LIST_OF_CHARS,) + '.' + RandomString(COUNT_OF_CHARS,LIST_OF_CHARS,)

We can specify how many characters it should contain using function ${__Random(MIN,MAX,)}

So finaly it may look like:

${__RandomString(${__Random(3,9,)},abcdefghijklmnopqrstuvwxyz,)}@${__RandomString(${__Random(2,3,)},abcdefghijklmnopqrstuvwxyz,)}.${__RandomString(${__Random(2,3,)},abcdefghijklmnopqrstuvwxyz,)}
Pixi Dixi
  • 113
  • 1
  • 6
  • 2
    Could you please [edit] in an explanation of why this code answers the question? Code-only answers are [discouraged](http://meta.stackexchange.com/q/148272/274165), because they don't teach the solution. – Nathan Tuggy Mar 12 '17 at 05:50