JMeter: Iterating over a set of CSV files over a set of links - nested loops



  • I have a set of JSP Pages for each I have a set of links to use for the response time measurements. In order to aggregate the results correctly I am trying to run a foreach controller over a loop controller using the csv data set config element. Somehow I cannot get the setup to parameterize the filename of the CSV config element.

    • ThreadGroup
      • JSP Names
      • Foreach JSP Controller
        • Loop Controller
          • CSV config reading from ${jspPage}.csv (not working)
          • HTTP Request

    any ideas?



  • Given that your foreach controller works and ${jspPage}.csv is being correctly populated it should be fine to read CSV data.

    Assuming that you have each link in a new line could you please make sure that following configuration is applied:

    For Loop Controller: should be > than 1 loop. Elsewise it'll read only the first line.

    For CSV Data Set Config:

    1. Filename - ${jspPage}.csv (should resolve to csv file)
    2. File encoding - must match your file encoding (it's recommended to use UTF-8)
    3. Variable name - anything meaningful. If you're using full URLs like protocol://host:port/path you need to split it via Beanshell function elsewise you'll be getting errors like "Host is null"
    4. Delimiter - something like "\r\n" (without quotes). You may wish to use

      ${__BeanShell(System.getProperty("line.separator");)}
      

      as line separator may vary on Windows, MacOSX and Linux.

    Other properties are according to your use case. With defaults which are

    • Allow quoted data - false
    • Recycle on EOF - true
    • Stop Thread on EOF - true
    • Sharing mode - all threads

    You should get the number of requests per JSP CSV file equal to loops, defined in your Loop Controller.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2