JMeter pressure test file upload interface and Chinese garbled characters

1. Pressure test file upload interface

Create a new test plan and add the required components.

insert image description here

1. Add HTTP header manager

It can be added in the test plan or in the thread group.

insert image description here

My interface uses token information. Added here in the test plan.

insert image description here

2. Add thread group

insert image description here

The above figure explains: 5 threads will be started within 2 seconds, and each of these 5 threads will call the interface once in a loop.

3. Add HTTP request

insert image description here
When setting interface parameters, you need to pay attention to:

  1. Do not add Content-Type: multipart/form-data to the request header, just check - use multipart/form-data for post.
  2. File upload parameters:
    • File name: By default, it will search for files under the path where the test plan is located. We can use the absolute path to specify the file to be uploaded.
    • Parameter name: The interface accepts the parameter name of the file, which is usually file.
    • MIME type: It is possible to use application/octet-stream, and it is best to correspond one-to-one with the uploaded document type.
  3. Parameters: Other parameters required by the interface.

MIME Reference Manual: https://www.w3school.com.cn/media/media_mimeref.asp

4. View the result tree

In the result tree, all the responses returned by the corresponding http interface will be printed out. You can choose to display only the error log and only the success log.

insert image description here

Result tree description:

  • Sampler result: the return value is reported as 200, indicating that the debugging of the execution interface is successful
  • request: the data sent
  • Response data: the returned data

where the sampler result description:

  • 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: the returned header information

5. Aggregate report

The aggregation report is a summary report for each request and the overall request at the end of the stress testing process.

insert image description here

Aggregate Report Description:

  • Label: HTTP Request name attribute value.
  • Samples: How many requests are issued during the test, that is, the total number of threads, (if 10 users are simulated and each user iterates 10 times, 100 is displayed here), corresponding to the number of samples in the graphical report.
  • Average: The average response time of a single Request, calculated by dividing the total running time by the total number of requests sent to the server, corresponding to the average value in the graphical report.
  • Median: Response time for 50% of users.
  • 90%Line: The response time of 90% of users.
  • Min: The minimum time for the server to respond.
  • Max: The maximum time for the server to respond.
  • Error%: The error rate in this test, the number of requests/total number of requests.
  • Throughput: Throughput, by default means the number of completed requests per second.
  • KB/Sec: The amount of data received from the server per second, that is, the number of bytes requested per second, and the time unit is ms.

6. Graphical results

Graphical results: Overall parameter visualization during stress testing.

insert image description here

Graphical result description:

  • 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 elapsed time divided by the number of requests sent to the server.
  • Median value: Half of the server response times are below this value and the other half are above this value.
  • Deviation: Indicates the change in server response time and the size of the measured value of dispersion.

Two, Jmeter Chinese garbled problem

When using Jmeter, there will be problems with Chinese garbled characters, mainly including Chinese garbled characters in the request body, Chinese garbled characters in response messages, and Chinese garbled characters in file uploads.原因是:Jmeter源码里默认的编码是ISO-8859-1。

1. Solve the request parameter Chinese garbled characters

The HTTP request control points to UTF-8, which can solve the Chinese garbled characters in the request.

insert image description here

2. Solve the Chinese garbled characters in the response data of the result set

jmeter.properties under the jmeter/bin path, line 1098, will be the default sampleresult.default.encoding=ISO-8859-1改为UTF-8, and finally restart the JMeter tool. The Chinese garbled characters in the returned results can be solved.

sampleresult.default.encoding=UTF-8

insert image description here

insert image description here

3. Chinese garbled characters in the uploaded file

We try to use the English file name test. I have not tried to solve the Chinese garbled characters in the uploaded file, please refer to the following article.

Reference article:

– If you are hungry for knowledge, be humble if you are foolish.

Guess you like

Origin blog.csdn.net/qq_42402854/article/details/129620025