8

I need to test the same set of urls against 5 to 10 servers. URLs are defined in the CSV file. Server names are defined in User Defined Variables config.

I'm using While Controller based on the number of servers to iterate and execute the url requests. My current logic is defined as below:

Thread group
  While controller
   Counter (defines number of servers)
   While controller (inner check "${URL}" != "<EOF>")
     CSV Data Set Config (stop EOF is true)
       HTTP Sampler (with url data)

As per the logic my script will run and read the CSV file once and stop. It's not reading the outer loop. Only inner loop and stopped.

Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123
user1767083
  • 157
  • 1
  • 3
  • 10

1 Answers1

19

Quote from JMeter Manual of CSV Data Set:

By default, the file is only opened once, and each thread will use a different line from the file. However the order in which lines are passed to threads depends on the order in which they execute, which may vary between iterations. Lines are read at the start of each test iteration. The file name and mode are resolved in the first iteration.

Thread groups cannot be nested. So you have to use the threadgroup to iterate in CSV and foreach to iterate in something else. The second option is to generate a CSV with the URL+Server variations, and using simply a single threadgroup to read the CSV.

First option is here.

Iterating URLs outer loop, iterating servers inner loop. You just need a threadgroup and a foreach inside it. See the pictures: User defined variables (servers) enter image description here enter image description here enter image description here

Sample results: enter image description here enter image description here enter image description here

And of course 3 more results...

You can also play with CSVRead function if you have time :)

Community
  • 1
  • 1
Gábor Lipták
  • 9,646
  • 2
  • 59
  • 113