Abhishek SIngh
Abhishek SIngh

Reputation: 23

How can i generate dynamic sequence number of transaction controller

Usecase :- I have one thread group. Inside this i have one loop controller. In loop controller i have 120 transaction controller. During debugging of the script it creates confusion to find the failed steps. I want to put some variable for dynamic number generation. I did it by using Beanshell Sampler as following:

enter image description here

After this i used beanshell function ${__BeanShell(Integer.parseInt(vars.get("POC_Step_Number"))+1,POC_Step_Number)} inside the name of transaction controller. It works for me. enter image description here

I want to use variable name in place of Beanshell function ${__BeanShell(Integer.parseInt(vars.get("POC_Step_Number"))+1,POC_Step_Number)} function. How can i do that?

Upvotes: 0

Views: 2228

Answers (1)

Ori Marko
Ori Marko

Reputation: 58782

You can use loop controller index (add +1 if you want to start with 1)

${__groovy(${__jm__Loop Controller__idx}+1)}

JMeter will expose the looping index as a variable named jm__idx. So for example, if your Loop Controller is named LC, then you can access the looping index through ${__jm__LC__idx}. Index starts at 0

Upvotes: 1

Related Questions