jmeter - how to access dynamic array of variables in scripting?

347 Views Asked by At

In An API call, we are having an array (the size is dynamic) where I want to validate the the date property of each array element. How can I access these array values dynamically in my script to validate the contents of the fields?

In the debug sampler / view results tree, I can see that for example I have a match NR of 3 and 3 variables.

list_1, list_2, list_3 lyst_matchNR=3

But the size if the list is random, so I can't just hardcode ${list_1} and so on.

1

There are 1 best solutions below

2
On BEST ANSWER

The easiest way of iterating these list_ variable is using ForEach Controller, just set "Input" and "Output" variables to list and it will trigger as many children executions as there are matches of your list variables:

enter image description here

The approach is described in more details for visiting each link found at the webpage in the Using Regular Expressions in JMeter article