Reputation: 1
For example, below is the JSON request data to "add a device" in the DB. For example, I want to add 10000 devices with different IMEI number and different phone number to the server for testing purpose. So, how to send the request at once. I'm ready to create 10000 devices data with different values manually. Now I can able to send one by one only.But how to send all the request at once?
{ "device_name":"34793812453274392", "imei_num":"36xxxxxxxxxxxx5", "phone_num":"8666606451", "device_city":"Chennai", "device_state":"Tamil Nadu", }
As I'm new to Jmeter, required detailed info. Thanks in advance.
Upvotes: 6
Views: 28690
Reputation: 223
Note: Unselect Run Thread Groups Consecutively (i.e one at a time).Below is a screenshot for overall architecture: Each thread group have one post method with a different body
There is also a different way in which you can pass your inputs via CSV file. You can check that out here: https://www.blazemeter.com/blog/jmeter-parameterization-the-complete-guide
Upvotes: 4
Reputation: 181
You should add multiple "Thread Group" into a "Test Plan". Inside "Test Plan" Unselect "Run thread groups consecutively".
Inside every "Thread Group" configure "Number of Threads(users)" as "1", "Ramp-Up Period" as "0", "Loop Count" as "1".
Now, add "HTTP Request" into each "Thread Group". Every "HTTP Request" you can add your "JSON file" and configure the "URL". Configure all the "HTTP Request" according to this.
Now add "View Results Tree" as a listener into a "Test Plan". Now run the Test plan.
Upvotes: 10
Reputation: 168072
You can use __Random() function to generate different phone_num
and imei_num
values like:
{
"device_name": "34793812453274392",
"imei_num": "${__Random(111111111111111,999999999999999,)}",
"phone_num": "${__Random(8666606451,9999999999,)}",
"device_city": "Chennai",
"device_state": "Tamil Nadu",
}
In order to configure JMeter to send all 10 000 requests at exactly the same moment:
Number of Simultaneous Users to Group by
to 10000
Be aware that 10 000 is quite high number of virtual users so make sure you're following JMeter Best Practices in your script.
Upvotes: 1
Reputation: 637
However, JMeter is able to simulate multiple concurrent users using Thread Groups. You can then combine a CSV Dataset config with your Http Request Sampler like explained in Multiple Login with JMeter.
The CSV should contain the IMEI numbers. Each concurrent thread group will pick a different value from the CSV value and send it within the HTTP Sampler.
Remember Http Requests within a Thread Group can only be played sequentially.
Upvotes: 1