Hey. Hello everyone, I am 4U:
Interface testing can detect software bugs in advance, effectively reducing software development costs, and interface performance stress testing can also achieve the same effect. If the LR is a cannon, then the JM is a sniper rifle.
So today we will talk about interface performance stress testing.
When developing a web page or an application program backend interface, it is generally necessary to test whether the developed interface can receive and return data correctly.
If you need more study materials+: ceshiren666
1. Create a test plan
When jmeter is started by default, a test plan template will be loaded, and the test plan will be saved: change the name to Apitest, click Save, select the save path, and in the following steps, every time you add or modify some options, the software will not automatically save it to the jmx file. , so after the test, if you need to save the test options, you need to manually go to the "File" menu to save it.
2. Add a thread group
Right-click the test plan "Apitest" node in the tree on the left. After the "Add" → "Threads" → "Thread Group" is
successfully added, there is a "Thread Group" node under the "Apitest" node. Of course, the name of this thread group can be your own. set
3. Add http default request
Right-click on the thread group, select "Add" → "Configuration Element" → "HTTP Request Default Value", click "HTTP Request Default Value" and after the addition is successful, there is a "HTTP Request Default Value" node under the "Thread Group" node.
Description: This section is used to configure public parameters, not http requests
. Here you can set the host address and other public parameters. For example, in our example, the request path is preceded by the host address + index.php, which can be unified in the "http request default." set in "value"
Fill in the default request name, server, and default request path, and save the test plan.
Fourth, add the http request header
This item is not necessary, but in our example, Userid and Token are used in the HTTP request header for user authentication. Right-click "Apitest", select "Add" → "Configuration Element" → "HTTP Header Manager" ".
Five, add http request
Right-click "Apitest", select "Add" → "Sampler" → "HTTP Request"
After the addition is successful, a new node "HTTP Request" will appear, and you can fill in the specific request parameters, complete the filling, and save the test plan.
6. Add a listener
Right-click the thread group and select "Add" → "Listener" → "XXXXXXXXX"
There are many kinds of listeners that can be added, and multiple listeners can be added. Here we add several commonly used "Graphical Results", "View Result Tree", and "Aggregate Report"
. nodes
Seven, test run script
Click the execute button
to view the results of each "listener"
-
Label: Each JMeter element (such as HTTP Request) has a Name property, and the value of the Name property is displayed here.
-
#Samples: Indicates how many requests you have issued in this test. If you simulate 10 users and each user iterates 10 times, then 100 is displayed here.
-
Average: Average response time - by default, it is the average response time of a single Request. When using the Transaction Controller, the average response time can also be displayed in units of Transactions.
-
Median: The median, which is the response time for 50% of users.
-
90% Line: 90% of users have a response time of no more than n seconds.
-
Note: For the meaning of 50% and 90% concurrent users, please refer to the following.
50 th (60/70/80/90/95 th): If the response time is sorted from small to large, then 50% of the requests have the response time within this range. The following 60/70/80/90/95 th is also the same meaning -
Min: Minimum response time.
-
Max: Maximum response time.
-
Error%: The number of requests with errors/total number of requests in this test.
-
Throughput: Throughput - By default, it indicates the number of requests per second completed (Request per Second), and when the Transaction Controller is used, it can also indicate the number of Transaction per Second similar to LoadRunner.
-
KB/Sec: The amount of data received from the server per second, equivalent to Throughput/Sec in LoadRunner.
8. Modify the number of threads for stress testing
Click "Thread Group" in the tree navigation on the left to
set the above parameters. The total number of simulated requests is: number of threads * number of loops. Execute it and check it out with the Graph Results listener.
-
Number of samples: The total number of requests sent to the server.
-
Latest sample: A number representing the time when the server responded to the last request.
-
Throughput: The number of requests processed by the server per minute.
-
Average: Total runtime divided by the number of requests sent to the server.
-
Median: The number of times at which half of the server response times were below and the other half were above.
-
Deviation: Changes in server response time, the magnitude of a measure of dispersion, or, in other words, the distribution of the data
Summarize new knowledge every day
Today, we explained in detail the detailed steps of the actual application of Jmeter, and also marked the middle value name to the students, so that you can easily and effectively grasp the essence of the performance stress test.
If you like the dry goods prepared by 4U for you, friends can help to forward it. Let more people know about us.
Thank you all, see you next time.
CONTACT US / Contact us
VX/Official public
account Lebo software test
Toutiao/Official Account
Lebo Software Test
TIKTOK/Official Douyin
Software Test Daleer
BILIBILI / Bilibili Lebo
software test
Himalaya/Official
account