0
votes

I'm using v5.1.1 of JMeter and attempting to use the "CSV Data Set Config". The file is read correctly as I can tell from the Debug Sampler/Results Tree, but the file is not being read line by line. In other words, it reads the first line and never proceeds to the next line for processing. I would like to use the data inside the CSV to iterate over a series of HTTP Requests to an external API. I currently have a single thread with only the "CSV Data Set Config" and "HTTP Request". Do I need to wrap this with a ForEach controller or another looping construct? Perhaps I'm missing it but I do not see in the documentation that would indicate it's necessary.

Thanks

2

2 Answers

0
votes

You dont need to wrap this in a ForEach loop. First line in the CSV file is a var name:

Let's say your csv file looks like

foo, bar
1, John
2, George
3, Laura 

And you use an http request sampler then ${foo} and ${bar} will get iterated sequentially. However please make sure you are mindful about the CSV Data Set Config options. The following options works ok for me: enter image description here

0
votes

By default CSV Data Set Config doesn't trigged any "looping", it reads next line from the CSV file for each thread (virtual user) for each iteration.

So if you want to see more values from the CSV file - either add more users or loops or both.

Given

  1. This CSV file:

    line1
    line2
    line3
    
  2. Following CSV Data Set Config setup:

    enter image description here

  3. And the following Thread Group setup:

    enter image description here

  4. You will get the following values (assuming __threadNum() function to visualize current virtual user number and ${__jm__Thread Group__idx} pre-defined variable to show current Thread Group iteration) :

    enter image description here

Check out JMeter Parameterization - The Complete Guide article for more information on various approaches on parameterizing JMeter tests using external data sources