In my setupThread, I firstly run some code to generate a property containing a file path. I then want to use this file path as the filename parameter for a CSV data set config (still within the setupThread).

My setupThread structure is basically:

  • Identify file path and put into property.
  • Loop controller
    • CSV data set config with {__P(filePath)} as the filename
    • Subsequent requests in loop.

I have seen in other questions that using properties should be possible. However, what I've found is that:

On the first run, the property is set (seen in debug sampler) but the csv data set (and subsequent requests) fail as "File 1 must exist and be readable". Here, it doesn't even enter the loop itself (seen with debug sampler or logging "Hello world" etc.).

On the second run, it all works fine. I am assuming this is because the file path property was set beforehand?

I know I can pass in the file path from command line and that should be fine. I can obviously hardcode a default file path alongside the property as a fallback, but that doesn't seem like a good solution either.

I suspect it would all be fine in the scenario where the property was set in setupThread and then the csv data set were in a subsequent thread group. But I need the "subsequent requests" mentioned earlier to run in the setupThread as well.

Any ideas are much appreciated!

1 Answer 1


You cannot, as per Execution Order chapter of JMeter documentation Configuration Elements are executed before anything else so being a configuration element CSV Data Set Config is being run before your code which modifies its path.

The only way to use dynamic paths to CSV files is using __CSVRead() function, check out How to Pick Different CSV Files at JMeter Runtime article for more details if needed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.