JMeter - How to pass data from the CSV Data Set Config to the ForEach Controller

1.9k Views Asked by At

My .csv file contains only one column called domain
I have very simple script:

Thread Group
      CSV Data Set Config
      Debug Sampler - ${domain}
      ForEach Controller (in has input variable domain and output variable out)
            Debug Sampler - ${out}

It executes the first Debug Sampler but not the second one.
I assume that ForEach does not get the domain variable from the CSV Data Set Config.
Please help.

enter image description here

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

you are using the For Each Controller in the wrong manner. basically, it expects the input as a list of values, which can be accessed using domain_1, domain_2 etc where domain is the value defined in the Input variable prefix field. This controller is primarily used with the combination of Reg Ex Extractor, which gives similar out (list of values) and accessing mechanism of them (using domain_1).

In your case, domain_1 & domain_2 are not defined, samplers inside won't be executed.

So, you must create/provide the input in the format For Each Controller expects Or use other controllers like While Controller etc.

Note: In order to provide the list of values as For Each Controller expects from CSV file, you can define more columns as follows:

domain_1,domain_2,...domain_n
google,yahoo,...bing

so, you can define Input variable prefix as domain, and make domain_1 & domain_2 variables available to the For Each Controller (As defined in the column fields).