0

I have created a loop in Jmeter and I have a counter within the loop.

vars.put("counter", "5")

I am then incrementing the loop by +5 for every iteration of the loop. What I am trying to do is add that counter to this:

${__timeShift(HH:mm:ss,,PT5M,,)}

So I am trying to dynamically add 5 minutes to the TimeShift each iteration. so something like ${__timeShift(HH:mm:ss,,PT${counter}M,,)}. I know this is wrong but I can't think of a way to do it. Does anyone have any ideas?

  • I know the counter I am using is a String. I am converting it to an int and then trying to add the int into timeShift like: ${__timeShift(yyyyMMdd,,P${i}D,,outputDate)} – That'llDoPig Aug 23 '22 at 17:32

1 Answers1

0

This guy: ${__timeShift(HH:mm:ss,,PT${counter}M,,)} should work just fine, most probably the problem is with the way you're incrementing the counter.

Instead of scripting you can consider switching to Counter configuration element:

enter image description here

So you would be able to get something like:

enter image description here

If you want to continue with scripting be aware of vars.putObject() function which allows you storing any arbitrary object into JMeter Variables so you won't have to convert it from String to Integer and vice versa

Dmitri T
  • 159,985
  • 5
  • 83
  • 133