Interface test tool -Jmeter pressure test use

Jmeter is an open source stress test tool developed by Apache company based on Java. It is small in size, full of functions, and easy to use. It is a relatively lightweight test tool and very simple to use. Since JMeter was developed in Java, JDK must be installed to run it. Jmeter is install-free and can be used on Linux/Windows/MacOS by unpacking the package. Jmeter can do interface testing and stress testing. The simple operations of interface test include making HTTP scripts (sending GET/POST requests, adding cookies, adding headers, adding permission authentication, uploading files), making WebService scripts, parameterization, assertion, association (regular expression extractor and processing JSON-JSON path) Extractor) and JMeter operate databases, etc.

Jmeter download

Go to the official website: jmeter.apache.org/

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

2. Download the package and decompress it.

3.Jmeter corresponds to JDk1.8. And then decompress. Make sure your environment variables are configured correctly (both JDK and JMeter).

2. Jmeter environment variable configuration

1.) computer desktop, “” computer” icon – “the right mouse button to select” properties “- > click advanced system Settings – > advanced – > environment variables page

 

 

2) Start to configure environment variables. In the system Variables box, click “New” and create a variable: JMETER_HOME, which is the jMeter installation path you extracted. My installation path is in disk E. The installation path is based on the actual installation path. Then click OK to save

3) Configure the classpath variable. If you do not have the classpath variable, follow the above steps to create it. If you do have the classpath variable, select it and click Edit. The variable value is fixed to: %JMETER_HOME%\lib\ext\ apacheJmeter_core.jar; %JMETER_HOME%\lib\jorphan.jar; % JMETER_HOME % \ lib/logkit – 2.0. Jar; When you’re done, save it. If you’re not sure, click ok until you’re back to my computer

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

First go to your JMeter installation path, find the bin folder, click in, find jmeter.bat, right mouse to run in administrator mode, or directly double-click to open, this will pop up two interfaces: 1. The command window cannot be closed when using JMeter. You can zoom to the taskbar on your computer. 2. Another interface is the JMeter working page, where you can perform related operations. Concrete as shown in figure

 

5) To check whether the installation is successful, double-click jmeter.bat or run it as an administrator.

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

Iii. Jmeter test case

Add this test plan (right-click -> Add ->Threads (Users) ->Thread Group)

2. Set the number of threads (the number of concurrent threads)

 

3. Add protocols and related configuration information

4. Add listeners to the thread

5. Start the test

 

6. Review the report

View the result tree

Aggregated report

Graphic results

Iv. Analysis and review of results

When the test is complete, all you care about is the test result. Jmeter provides a variety of components to View test Results, such as View Results Tree, Summary Report, Graph Results, and so on

1, View Results Tree

Return data:

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

Request: Sent data

Response data: Returned data

Thread Name: indicates the Name of the Thread group

Sample Start: indicates the Start time

Load Time: Load time

Latency: indicates the Latency

Size in bytes: indicates the total Size of data to be sent

Headers Size in bytes: indicates the size of the rest of the data to be sent

Sample Count: indicates sending statistics

Error Count: indicates the statistics of interactive errors

Response Code: Return code

Response Message: Returns the message

Response Headers: The returned header information

2, AggregateReport

  1. Label – Specifies the name attribute value of the request.
  2. Samples – Number of Samples with the same label, total number of requests sent.
  3. Average – The Average response time of a request.
  4. None of the median-50% samples exceeded that. This value refers to the order of all data in ascending order, which is the value in the 50%.
  5. 90% line-90% of the samples did not exceed that time. This value refers to the order of all data in ascending order, which is the 90th value.
  6. 95% line-95% of the samples did not exceed this time. This value refers to the order of all data in ascending order, that is, the 95th value.
  7. 99% line-99% of the samples didn’t exceed that time. This value refers to the order of all data in ascending order, which is the 99th value.
  8. Min: Indicates the minimum response time.
  9. Max – Maximum response time.
  10. Error % – The percentage of incorrect requests in this test.
  11. Throughput – Throughput is measured in requests per second/minute/hour. This is the number of requests completed per second.
  12. Received KB/ SEC – Received kilobytes per second of throughput tests.
  13. Sent KB/ SEC – Throughput test of kilobytes per second Sent.

3 and Graph the Results

  1. No of Samples: Total number of requests sent to the server.
  2. Latest Samples: A number representing the time when the server responded to the last request.
  3. Average: Total elapsed time divided by the number of requests sent to the server.
  4. Devaition: indicates the measurement value of server response time change and dispersion degree.
  5. Throughput: Number of requests processed by the server per minute.
  6. Median: Half of the server response times are below the value and half are above it.

4. jp@gc – Transactions per Second

5. Save the file

Most components provide the ability to save test results to a file. Specify an absolute path to the output file as follows:

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

6. Generate web page reports

  • To execute the script on the command line, note: if no environment variables are configured, start the command line in the jMeter installation directory bin,
  • Command:
  •  
Jmeter-n -t D:\program\apache-jmeter-5.0\samples\ 28.Summary_report. JMX -l D:\ summary.jtl-e -o D:\ resultCopy the code

 

Green: Indicates the script to be executed

Blue font: generated script

Red: The storage path reported by the Web page

  • View the results and generate nice test reports

References:

1, www.cnblogs.com/monjeo/p/93…

2, blog.csdn.net/kongsuhongb…

3, blog.csdn.net/github_2710…

4, www.cnblogs.com/imyalost/p/…