Reputation: 1877
newbie to jmeter.
i am trying to test the file upload portion of my site
I need to test multiple upload file types.
so for i have working
-- http request sampler to login
-- http request sampler to upload the file using "Send files with the request" (This is where i have the absolute path tothe upload file. where i would like to put a variable)
-- another http sampler to validate the upload
This all works fine. Now i want to loop through different scenarios based on the the thread count
int idx = ctx.getThreadNum();
I load some values for that loop based on idx
the part i can not get working is uploading a file specific to the thread idx
to hack this to get it working i have Swith controllers for each thread id that uploads a different file. this is problematic as each thread i want to add, i will have to add a new switch controller. This can not be the correct way to do it.
I appreciate any help
Upvotes: 0
Views: 692
Reputation: 168082
Just use __threadNum() function in the "File Path" input like:
The function returns current thread number (starting with 1) so you will be able to upload different files with different threads.
By the way, int idx = ctx.getThreadNum();
returns thread numbers starting from 0, maybe that's why your test doesn't work as expected.
See How to Use JMeter Functions articles series for comprehensive information on above and other useful JMeter functions.
Upvotes: 1