1

I am trying to load test a Register-Search application which will do as the name suggests for ~5 million mobile numbers. Will be using 100-500 threads with looping through a specific delay between each loop.

I have the functional test JMeter script ready for the same. The only change I want to do is generate the mobile number automatically.

The easiest solution would be doing having the mobileNumber as ${random(${min},${max})}. But I want to avoid it and get a more linearised approach by using property mobileNumber

In a JSR223 Sampler (using Groovy script), I was trying to read the property as

long number = ${__P(mobileNumber)}
vars.put("mobileNumber", String.valueOf(number))

I wish to use the UDV mobileNumber thus created in current thread and increment the property mobileNumber by 100. Trying to do:

number = number + 100
${__setProperty(mobileNumber, String.valueOf(number))

For some reasons it is not working and giving error message Response message:

javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: number for class: Script1

Cant figure out whats wrong ?

cfrick
  • 35,203
  • 6
  • 56
  • 68
Suhas Deshpande
  • 183
  • 2
  • 3
  • 15

1 Answers1

1

You can do it without any scripting by using just JMeter Functions as:

  • ${__longSum(${__P(mobileNumber)},100,tempNumber)} which
    • reads mobileNumber property
    • adds 100 to it
    • stores the result into tempNumber variable (however if you don't need it you can omit this)
  • ${__setProperty(mobileNumber,${tempNumber},)} - store tempNumber variable value as mobileNumber property

Functions used are:

  • __longSum - computes sum of 2 or more long values
  • __P - returns value of a JMeter Property
  • __setProperty - assigns value to a JMeter Property
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • So I think my solution may go like **vars.put("mobileNumber", ${__P(mobileNumber))** To get the value of property mobileNumber and store it to the current thread-loop variable mobileNumber **${__setProperty(mobileNumber,${__longSum(${__P(mobileNumber)},100,)}** To increment property mobileNumber – Suhas Deshpande Jan 07 '15 at 03:14