Reputation: 2349
I am trying to build a Jmeter test plan that can make http calls to a server. Each thread in the thread group will read 2 parameters from a CSV file and make the http call with the params, and continue to make the same call with same parameters for lets say 1000 times with a delay of 10s between each thread execution.
The http call looks like
/service/method?param1=${param1}¶m2=${param2}
The CSV is like this:
1,2 3,4 5,6 7,8
I have the test plan set up that works for the most part except the single issue. I want each thread to use the same parameters (same line of input) whenever the thread executes. Currently the only way to do it is to set Recycle on EOF = true
, but the threads randomly pick the values. Param1 and Param2 can be randomly generated values as long as they stick with the same thread throughout the execution.
Is there anyway I can achieve this?
Thanks!
Upvotes: 1
Views: 3779
Reputation: 2349
I was able to find sort of a hack. Basically I just put a constant timer for each thread and used the thread number ${__threadNum} as the parameter to fit my constraint of having the same parameter to be used by the same thread.
I would still prefer a way to read the params from a csv file.
Upvotes: 0
Reputation: 12873
I'm not really sure I understand your issue right (you can possibly describe it more explicitly or using an example) but the schema below should implement your test-plan description:
Test Plan Thread Group Number of Threads: N . . . While Controller Condition: ${__javaScript("${param2"!="<EOF>",)} - read csv-file until the EOF CSV Data Set Config Filename: [path to your file with test-data] Variable Names: param1,param2 Recycle on EOF? False Stop thread on EOF? True Sharing mode: Current thread group Loop Controller Loop Count = 1000 - number of loops for each thread, with the same params HTTP Request - your http call Test Action Target = Current Thread Action = Pause Duration (ms) = 10000 - pause between calls . . .
In case if you need that each of N threads reads and uses single and unique line from csv-file you have to set Sharing mode: Current thread group
for CSV Data Set Config (number of csv-entries should be in this case the sane as threads number, or Recycle on EOF? False
should be set otherwise).
In case if you need that each of N threads reads and uses all lines from csv-file you have to set Sharing mode: Current thread
for CSV Data Set Config.
If that's not what you want please describe your issue a bit more clear.
Upvotes: 3