33

I am trying to do some test with jMeter.

I have CSV file with the urls and want to iterate over all of them and make HTTP Request. I have achieved that by typing exact number of urls in the ThreadGroup in Loop Count field.

Is there any possibility to set jMeter in that way it will loop over the urls without the need to type count of the urls in ThreadGroup? Any controller can do this?

Marc Climent
  • 9,434
  • 2
  • 50
  • 55
firen
  • 1,384
  • 2
  • 14
  • 32

1 Answers1

52

You can define the urls in the csv data format and have Jmeter loop through it.

The csv file can be defined and loaded with the CSV data config.
The variable names stand for each of the columns in the csv file, and can be referred in the loop controllers.

Example:

  1. Define an while controller with the Condition as ${url}
  2. Define an child CSV Data Set Config, with the file path and the variable name url which stands for the column listing the urls.
  3. Use the ${url} with the http request handler to fire the request.
  4. To stop execution after the end of the CSV file is reached: within the CSV Data Set Config set Recycle on EOF? = False and Stop thread on EOF? = True.
dsummersl
  • 6,588
  • 50
  • 65
Jayendra
  • 52,349
  • 4
  • 80
  • 90
  • But don't I have to set count of ulrs in file explicitly in ThreadGroup? I am asking for not having to set count explicitly. – firen Oct 19 '11 at 22:27
  • 2
    I did as you wrote, and when it reach the end of file then it goes to the beginning and do everything in infinite loop. – firen Oct 21 '11 at 14:19
  • 7
    you need to set true for Stop thread on EOF in the CSV data Set config, which would stop the loop. – Jayendra Oct 21 '11 at 14:26
  • 1
    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. Just if that helps someone... – Hussein Hijazi Sep 16 '20 at 14:18