Reputation: 33
As the title suggests, I am trying to figure out how to change the File Upload path in JMeter after X amount of seconds. I need this since I am testing an API that uses 60 files and I need to cycle through each file every minute. I already have an idea of using CSV Data Set Config but I'm not sure if that will change the File Path every minute like I need it to. Or maybe even read from the CSV file once per minute?
Upvotes: 0
Views: 203
Reputation: 168157
Use __P() function to read the path to the file from a JMeter Property path
${__P(path,)}
Add another Thread Group to your Test Plan and use a Debug Sampler in combination with CSV Data Set Config to read the next filename from the CSV file into path
JMeter Variable
Add a Constant Timer or Flow Control Action sampler to introduce 60 seconds of sleep between iterations
And finally add a JSR223 PostProcessor to convert path
variable into path
property:
props.put('path', vars.get('path'))
see Top 8 JMeter Java Classes You Should Be Using with Groovy article to learn what do these props
and vars
shorthands mean
That's it, Debug Sampler will be executed each 60 seconds, the CSV Data Set Config will read next value from the CSV file and the JSR223 PostProcessor will update the path
property value with the new filename or file path.
Upvotes: 1