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.
you need to set true for Stop thread on EOF in the CSV data Set config, which would stop the loop. JMeter supports CSV files which have a header line defining the column names. To enable this, leave the "Variable Names" field empty. This will automatically fill the corresponding variables with values of the columns.
The “CSV Data Set Config” enables using CSV files as an external data source, where you can keep unique user data like names, emails and passwords. With the help of this config element, JMeter is able to read the CSV file line by line, and then use split parameters to allocate different values for different threads.
Add the While Controller to your Test Plan. Put the HTTP Request sampler (or any other sampler if you're using a different protocol) under the While Controller. Save the partial or the whole response into a JMeter Variable. It can be done using the Regular Expression Extractor.
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.
Iterating URLs outer loop, iterating servers inner loop. You just need a threadgroup and a foreach inside it. See the pictures:
Sample results:
And of course 3 more results...
You can also play with CSVRead function if you have time :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With