======Jmeter environment configuration======
Jmeter environment installation and configuration
Open source and free under Apache
Java development-operating environment jre, jdk; cross-platform
1. Install jdk1.8
2. Download the free jmeter (greater than version 3.2) and unzip
3. Start jmeter
bin jmeter.bat jmeter.sh
Double click ApacheJmeter.jar or java -jar ApaceJmeter.jar in the
same system, you can start multiple jemters (same version, different versions) without configuring JMETER_HOME
- There are multiple *.properties in the bin folder, which are all jmeter configuration files
- jmeter.properties, the most important configuration file
- In subsequent courses, when it comes to the modification of the configuration file, there is no special explanation, that is the configuration file.
- If in the future, there is an error of the ***keystore*** keyword in the work, it means that there is no ssl certificate, and you need to generate the certificate manually, click create-rmi-keystore.bat
- jmeter.log == The log when jmeter is started. If jmeter crashes or fails to start, look at this file
- Flashback: During the course, there is no need to configure jmeter environment variables. If jmeter environment variables are configured, it is very likely that jmeter will crash when starting up, and it is found that the jmeter environment variables are inconsistent with your current jmeter path, resulting in: crash; a computer has and has a jmeter
- Do not configure jmeter environment variables:
1. It is allowed to run n multiple jmeters on one computer === It is actually impossible to be unlimited
2. On one computer, n different jmeter versions are allowed to run.
Disadvantages: when imeter-sever, there will be A warning message - bin: Put the startup files, configuration files, and save files of jmeter by default here.
- docs====The api file of the source code---I want to do secondary development to jmeter
- extras ==== CICD
- lib =====jmeter's own jar package
lib\ext===== third-party plug-in storage place
If you do secondary development to jmeter, put the jar produced? ==lib - printable_docs ====jmeter's offline help document ====corresponding version, will not be updated ====official online help file, always keep the latest one
======JMETERT-GUI window======
GUI graphical interface
CLI (non-gui) no graphical interface ====Performance testers must master
GUI == Right
Test plan ======jmeter test plan === project root directory name
A complete script of jmeter generally includes 3 components:
1. Thread group: for performance scenario design
2. Sampler: working, interface request, according to different protocols, choose different samplers
3. Listener: Display the response information of the request. The
result tree, display the components of the response of the request|
Among all components, all components under the configuration component are the highest priority
The general database is server+db
Tomcat default port: 8080, HTTP default port: 8080, HTTPs default port: 443, ftp default port: 21, sftp default port: 22, ssh default port: 22
mysql default port: 3306
If the repuest body is in json format, you must add a message header manager and write content-Type: application/json
======Jmeter write script =======
Jmeter handwritten script
Jmeter handwritten script - Http sampler
- protocol: empty, http, https
- Server Name or IP: server domain name or ip, must not have: /
- PortNumber port number: empty\80
- Method: HTTP request method, see the interface documentation for details
- Path path: url address, the protocol, domain name lip and other information have been written before, don’t write domain information for this
- content encoding content encoding: empty, utf-8 (general situation)
- Only valid for request body, invalid for response body
- 1. Content coding in the sampler: utf-8
- 2. In the parameters, check the code
- 3. Message header: charset=UTF-8 added inside
Response-body encoding:
Open jmeter.pr*** seckey: encoding---1084
sampleresult.default.encoding=ISO-8859-1
Modify this code: specific circumstances, see specifically, gbk\utd-8\gb2312
RedirectAutomatically vs Follow Redirects
Automatic redirection: only for GET and Head requests; it can automatically jump to the final page, but jmeter does not record the redirection process. The content of the redirection process cannot be found in the result tree and can not be associated
Follow redirect: selected by default; when the response code is 3XX, it will automatically jump, jmeter will record the redirection process, you can see the process content in the result tree, and you can make associations
Use keepAlive使用keepAlive
- HTTP 1.1 version, default long connection
- Request header: Connection: keep-alive
If the format of the request is: json, xml, the request-body is written in the [message body]; except for these two, and uploading files, the request-body is written in the [parameter]
Parameters: value, no need to quote
Check urlencode to prevent garbled
Value: Chinese or special symbols, such as =, be sure to check the coded password string
Therefore, no matter what the situation, it is recommended to check the code
Http Header Manager
- Right-click the thread group -> Configure Components -> HTTP header manager
- Scope
- Request header
- 1. Content-Type: application/x-www-form-urlencoded; charset=utf-8 default format, form form (in jmeter, when the message header is not configured, or the Content-Type is not configured in the message header, the default content- type: application/x-www-form-urlencoded)
- 2. application/json json\xml data
- Used when uploading files in the multipartfo/rm-data form
- User-Agent simulation browser
Other items: there are registration, login, login interface, prompt: please log in first
When there is a login interface in your script, you must add the cookie manager first, nothing is configured, the cookie manager saves the user's login information
View Result Tree
Thread group right click -> listener -> view result tree
Scope
Write all data to a file
- File name, error log only, configuration
Result display type
data
- Sampler results
- 请求:RequestBody、request headers
- Response information: ResponseBody, Responseheaders