How to access data inside foreach controller using JSR223 sampler with index value. For example
data_1 = something
data_2 = something
etc.
Whenever I tried using counter, it gives only data_1 for every count but in treeview I see that counter is working properly. How can I access every item in foreach controller.
What "data" do you want to access?
If you configure ForEach Controller like:
then you will be able to get the current value of
foovariable as:Current iteration of the ForEach Controller can be accessed as:
if you haven't changed the default name it would be:
Where
varsis a shorthand for JMeterVariables class instance, see Top 8 JMeter Java Classes You Should Be Using with Groovy article for more details on this and other JMeter API shorthands.