1.jmeter use,
Open the jmeter installation directory and double-click ApacheJMeter.jar in the bin directory (you can open jmeter when jdk is installed)
2. Add HTTP proxy server
Open jmeter, click on the test plan - click on add - click on the non-test component - click on add http proxy server
3. Proxy server settings
The default port number is 8888
(1) Test Plan Creation part:
Target Controller Selection-----Use Recording Controller Group Selection------Put each group into a new transaction controller
(2) Requests Filtering part:
In the Exclusions section below ----- click Add Suggested Exclusions i.e.
(?i).*\.(bmp|css|js|gif|ico|jpe?g|png|swf|woff|woff2).*
4. Add thread group
Click Test Plan----------Click Add----------Click Thread (User)--Click Thread Group
5. Add a recording controller to the thread group
Click on the newly added thread group------Click on Add------Click on Logic Controller------Click on Recording Controller
6. Proxy server settings on your computer
Click Settings --------- Find Network and Internet ---------- Find the proxy ----------- Manually turn on the proxy
The proxy server address 127.0.0.1 represents the local port number 8888 (consistent with the setting in jmeter)
7.Script recording
After opening the proxy server, click the start button in the HTTP proxy server in jmeter to record
(1) Record the test script - click the start button
Note that the Http proxy server is finally in the interface part of Test Plan Creation during recording.
(2) Stop recording - after the recording is completed, click to stop recording the test script:
8. The recorded test script (take the login of the web version of QQ Music as an example)
9. Add configuration components to the recorded thread group - CSV data file settings
Click Thread Group——Click Add————Click Configuration Component————Click CSV Data File Settings
10. Write and configure the new CSV data file settings
Click CSV data file settings-----Click browse in the file name part and select the required data file in .csv format up.csv
The file encoding part is generally UTF-8.
The variable name part is set according to the number of variables involved in the file. There are only two variables, the logged-in QQ account and password, which are named username and password respectively, separated by English commas.
Read the contents of the up.csv data file used. There are two columns of data. One column represents the QQ account and the other represents the password.
11. In the recording script of QQ Music Login China, use the data in the csv file read above to parameterize its account password.
Parameterization of account password ${username} and ${password} in qq music login script
Among them, username and password are the variable names defined in the csv data file settings, representing the qq account and password respectively.
12. Add viewing result tree and other content to the thread group (used to view test execution results)
Click on the thread group - click on add - click on the listener - click on view the result tree
13. Record test script execution
14. Record test script execution results
Click to view the result tree—the green shield shape indicates that the HTTP request has passed
You can view the current HTTP request body content in Request Body
-Ag0UhHpi-1683723570799)]
14. Record test script execution results
Click to view the result tree—the green shield shape indicates that the HTTP request has passed
You can view the current HTTP request body content in Request Body