Preface
Apache JMeter is a Java-based stress testing tool developed by the Apache organization. Used for stress testing of software. It was originally designed for web application testing, but later expanded to other testing areas. JMeter can be used to simulate huge loads on servers, networks or objects, test their strength under different stress categories and analyze overall performance. In addition, JMeter can perform functional/regression tests on the application, by creating a script with assertions to verify that your program returns the results you expect.
Official website: https://jmeter.apache.org/
installation steps
1. Download the installation package
Method 1: Download from the official website https://jmeter.apache.org/download_jmeter.cgi
Method 2: Link: https://pan.baidu.com/s/15DKxzieA0ni51bDv3qk5ag Password: 6cs4
2. Double-click to unzip after downloading
3. Enter the bin directory
cd bin
4. Change language (default is English)
vi jmeter.properties
In English input state, press i to enter insert mode, modify the following configuration
language=zh_CN
Press esc to enter : wq save and exit
5. Start
sh jmeter
5. The jmeter interface pops up after startup
Use tutorial
1. Create thread rent
2. Configure thread rent
Test: The http request of 30 users is completed within 2 seconds (setting on demand)
3. Create Http Request
4. Add http request related url and parameters
5. Add HTTP request header
6. Set the request header information (configure yourself according to your needs)
7. Add listeners (view result tree, summary report, aggregate report)
8. Start
9. View the results
Export report (extended)
1. Set the report export directory
No need to create files
2. Start
3. Modify the configuration file
Enter the jmeter/bin directory
vi jmeter.properties
In English input state, press i to enter insert mode, modify the following configuration
jmeter.save.saveservice.output_format=csv
Press esc to enter : wq save and exit
4. Execute conversion command (html)
- -e Generate an html report after the script runs
- -o save the address of the html report
- -g specifies an existing test result file
jmeter -g /Users/ww/Downloads/apache-jmeter-5.4.1/bin/report/result.jtl -e -o /Users/ww/Downloads/apache-jmeter-5.4.1/bin/report/html
PS: -o will automatically generate files, all files must not exist in the jmeter path. Every time an html report is generated, the jtl and output folders must be deleted, otherwise it will prompt:
An error occurred: Cannot write to '/Users/ww/Downloads/apache-jmeter-5.4.1/bin/report/html1' as folder is not empty
5. View report
After the execution is successful, enter the /Users/ww/Downloads/apache-jmeter-5.4.1/bin/report/html directory I set, find index.html and double-click to open