How to deal with garbled characters in the request content
-
1 Content-encoding: utf-8
-
2 Add encoding to the request header
Content-Type: application/json;charset=utf-8
-
3 When the request body is the parameter type, check the parameter "Encoding", and the encoding is the
urlencoded
encoding. When the parameter value is non-character (Chinese characters, special symbols), you need to check the encoding
What to do when the response content is garbled
Modify the value in jmeter.properties to the sampler.result.encoding
corresponding code.
Sometimes the same interface is encountered, and the response is normal with postman requests, but garbled characters appear when responding to Chinese with Jmeter. Because: Jmeter encoding is based on the encoding of the operating system, in China, the character set encoding of Windows system is gbk936
; the Chinese encoding of mac system is utf8.
How to choose parameters or message body data
When the request body is json
format or Content-Type: application/json
, generally choose to use消息体数据
When the request body Content-Type
value is form-data
or x-www-form-urlencoded
or 没有指明请求体类型时
, generally used参数
Auto-redirect and follow-redirect
Generally, the default value can be used. 跟随重定向
The redirection process is automatically displayed, and the desired information can be extracted from the process. 自动重定向
The intermediate redirection process is not displayed, and information cannot be extracted from the process.
KeepAlive: keep connection, long connection
The current http protocol version is 1.1, which is a long connection, so KeepAlive is checked by default, but in the performance test, this check will be removed as needed.
User-Defined Variables and User Parameters
User-defined variables are global variables with scope for the entire test plan. The value is fetched once when the run is started, during the run, the value is not fetched dynamically. That is, this value remains unchanged during operation. Even with multithreading, there is only one value.
User parameters are local variables, scoped to the current thread group or the current sampler. The value is obtained once when the operation is started, and the value can be obtained dynamically during the operation.
Study schedule!