Interface test tool-Jmeter pressure test use

Interface test tool-Jmeter pressure test use

Official description : jmeter is an open source stress testing tool developed by apache company based on java. It is small in size, full-featured, and easy to use. It is a relatively lightweight testing tool that is very simple to use. Because jmeter is developed by java, jdk must be installed first when running. jmeter is free to install, you can use it directly after you get the installation package, and it can be used on linux/windows/macos.
  jmeter can do interface testing and stress testing. The simple operations of interface testing include making http scripts (sending get/post requests, adding cookies, adding headers, adding permission authentication, uploading files), making webservice scripts, parameterization, assertion, and association (regular expression extractor and processing json -json path extractor) and jmeter operation database and so on.

One, Jmeter download

Enter the official website: http://jmeter.apache.org/

1. The first step is to enter the official website as shown below

image

2. Choose to download, download it as a compressed package, and unzip it.

3. Jmeter corresponds to jdk1.8. Then proceed to decompression. Be sure to ensure that the environment variable configuration is correct (including the environment variable configuration of jdk and jmeter).

Two, Jmeter environment variable related configuration

1.) Computer desktop----》"Computer" icon----》right-click and select "Properties"----》Click Advanced System Settings----》Advanced---》Environment Variable

 image

 

2) Start configuring environment variables. In the system variable box, click "New" to create a variable: JMETER_HOME, the value of which is the jmeter installation path you unzipped. My installation path is on the E drive, and this path is filled in according to my actual installation path. Then click OK to save

image

3) Configure the classpath variable. If not, follow the above steps to create a new one. If there is, select it directly and click Edit. The variable value is fixed as: %JMETER_HOME%\lib\ext\ApacheJMeter_core.jar;%JMETER_HOME%\lib\jorphan.jar;%JMETER_HOME%\lib/logkit-2.0.jar; Be sure to save it after you are done, if you are not sure, you can Click the OK button directly until you return to the My Computer page

image

4) The basic configuration is complete, and then verify whether the configuration is correct and whether it is available.

First go to your jmeter installation path, find the bin folder, click in, find jmeter.bat, right-click to run as administrator, or directly double-click to open, then two interfaces will pop up: 1. One is the command window, This command window cannot be closed when using jmeter, you can zoom out to the computer taskbar. 2. There is also an interface is the jmeter work page, you can perform related operations in it. The details are shown in the figure

image

 

5) Confirm whether the installation is successful, double-click jmeter.bat or run as an administrator, the page is as follows:

6) The working area of ​​jmeter is as follows: Every time we use jmeter, the first way to open it is to enter the bin file and double-click the jmeter.bat. If you find it troublesome, you can use the right mouse button shortcut to send the computer desktop, which will be much more convenient.

image

Three, Jmeter test case

1. Add this test plan (right click-->Add-->Threads (Users)-->Thread group)

image

2. Set the number of threads (the so-called number of threads is the number of concurrent)

image

 

3. Add protocol and related configuration information

image

4. Add a listener to the thread

image

5. Start the test

image

 

6. View the report

View the result tree

image

Aggregate report

image

Graphical results

image

Fourth, the result analysis view

When the test is complete, the most concerned thing is the test result. jmeter provides a variety of components to view test results, View Results Tree, Summary Report, Graph Results, etc., a brief introduction

1、View Results Tree

image

Return data:

Sampler result: The return value is reported as 200, indicating that the interface debugging is successful

Request: data sent

Response data: returned data

Thread Name: Thread group name

Sample Start: Start time

Load time: loading time

Latency: waiting time

Size in bytes: the total size of the data sent

Headers size in bytes: the size of the rest of the sent data

Sample Count: send statistics

Error Count: Interactive error statistics

Response code: return code

Response message: return information

Response headers: returned header information

2、AggregateReport

image

  1. Label-request the corresponding name attribute value.

  2.  Samples-The number of samples with the same label, the total number of requests issued.

  3. Average-The average response time of the request.

  4. Median-50% of the samples did not exceed this time. This value means to arrange all the data in ascending order, which is the value ranked in the 50th percentile.

  5. 90% Line-90% of the samples did not exceed this time. This value means to arrange all the data in ascending order, which is the 90th percentile value.

  6. 95% Line-95% of the samples did not exceed this time. This value means to arrange all the data in ascending order, which is the 95th percentile value.

  7. 99% Line-99% of the samples did not exceed this time. This value means to arrange all the data in ascending order, which is the 99th percentile value.

  8. Min-minimum response time.

  9. Max-Maximum response time.

  10. Error%-The percentage of requests with errors in this test.

  11. Throughput-Throughput is measured by the number of requests per second/minute/hour. This represents the number of completed requests per second.

  12. Received KB/sec-The received kilobytes per second throughput test.

  13. Sent KB/sec-The throughput test of sent kilobytes per second.

3、Graph Results

image

  1. No of Samples: The total number of requests sent to the server.

  2. Latest Samples: A number representing the time, which is the time when the server responded to the last request.

  3. Average: Total running time divided by the number of requests sent to the server.

  4. Devaition: Indicates the change in server response time and the size of the measured value of dispersion.

  5. Throughput: The number of requests processed by the server per minute.

  6. Median: Half of the server response time is lower than the changed value and the other half is higher than the value.

4、jp@gc - Transactions per Second

image

5. Save to file

Most components provide the function of saving test results to a file, just specify the absolute path of the output file, as follows:

image

After the execution is complete, open the file, you can view the original data information, and then process the original information according to your needs.

image

6. Generate reports on web pages

  • Execute the script under the command line. Note: If the environment variable is not configured, start the command line under the bin of the jmeter installation directory.

  • command:

  •  
jmeter -n -t D:\program\apache-jmeter-5.0\samples\28.summary_report.jmx -l d:\summary.jtl -e -o d:\result

 

Green font: indicates the script to be executed

Blue font: script after generation

Red font: the storage path of the web page report

  • View the results and generate a beautiful test report

image

Reference materials:

1 、https://www.cnblogs.com/monjeo/p/9330464.html

2、https://blog.csdn.net/kongsuhongbaby/article/details/96829880

3、https://blog.csdn.net/github_27109687/article/details/71968662

4 、https://www.cnblogs.com/imyalost/p/10239317.html

 

Guess you like

Origin blog.csdn.net/qingfengxd1/article/details/113779874
Recommended