I have the below requirement :-
- I have the User CSV file in which the Username & password is defined with which I have create all the users from the CSV file.
- Now I have couple of thread groups defined for different application pages which 'll have different API's.
- For all the thread groups, I have different no of threads assigned .(Let's say ,for thread group1 ,I have 5 threads from User CSV file which can be from line 1 to line 5 & thread group2 can have 3 threads which can go from line 6 to line 8 & so on). I want to get the user & password details from above mentioned file which requires only user name & password from the file.
- for all the users which are used in thread group 'll generate the token for each & every user which I want to append in a file (if possible, can we append it in same user file against the each & every user) & then later I want to use it for other activities.
2nd requirement :-
- I have a API call in which I am getting a total_count in response header (let say 3500).
- I want to compare the this count with any specific no either defined as variable (let say ${max_count} = 5000)
- Now I want to iterate the loop with a condition say : if total_count < ${max_count}, then loop should iterate for max_count else :- loop count should iterate for total_count only.
How can I do that with bean shell processor.
The solution I have tried :
for the 1st point , I went with set-up thread which should be the 1st thread to be run.
for 2nd & 3rd point, I have defined the thread groups with different CSV files for each thread (which I don't want as solution), as it may go for more than 100 csv files to be uploaded & used as the no of threads in each group are not identical .
for point 4, I haven't got any solution for it & same is the case for 2nd requirement.
First of all Beanshell scripting is some form of a performance anti-pattern, since JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting. See Apache Groovy: What Is Groovy Used For? for more information on Groovy scripting in Jmeter.
Example code implementing the "below requirement" would be something like this:
With regards to "2nd requirement" you can put the following __groovy() function into your Loop Controller's "Loop Count" input: