I have requirement with increment value for each iteration and using loop controller. I tried with the _V function and __intSum(${myVar},${__counter(,)},)}. it's incrementing only for digit and not for AlphaNum . my paylody body like this.


I'm using like below.


1 Answer 1

  1. Amend your body data as:

  2. Add JSR223 PreProcessor as a child of the request which payload you need to increment

  3. Put the following code into "Script" area:

    def numericPart = (vars.get('FirstName') =~ /(\d+)/)[0][1] as int
    def incremented = numericPart + 1
    vars.put('FirstName', vars.get('FirstName').replace(numericPart as String, incremented as String))
  4. That's it, each time the request will be called it will send an incremented value of the ${FirstName} JMeter Variable


enter image description here

More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.