Command line execution of Jmeter performance test and generation of test report

Prepare

Jmeter has two operating modes: one is the interface mode adopted above (GUI), which will occupy javathe resources of the virtual machine; the other is the command line mode execution, which saves resources, especially (non-GUI)in continuous integrationnon-GUI .

Configure environment variables

command line execution

command line format

jmeter -n -t <testplain filename> -l <listener filename>

Parameter Description:

testplain filename: The absolute or relative path of the jmx file
listener filename: the name of the result file after execution, the suffix must be .jtl

Debug pressure test request

Under the command line, if you want to view the results returned by each request, you need to modify jmeter.propertiesthe configuration file

 Open the above comment and modify the value to true, the record will be opened, and jmeter will output the information to the jtl file we specified. Don’t pay attention to the pressure test process, which will generate a large number of such records , it is best not to enable too many log records during real pressure testing.

View stress test results in real time

Under the jmeter command line, you can also view the pressure test results in real time, and also modify the configuration file jmeter.properties

Open the above three configuration items summariser.name, summariser.interval, summariser.out, save, and re-run jmeter, you should be able to see the statistical information in the shell. 

Generate test report

Execute the command as follows

jmeter -n -t test.jmx -l result.jtl -e -o ./result_report

Parameter Description:

n: Execute JMeter in non-GUI mode
t: path of the script file (.jmx file)
l: specify the save file (.jtl format) for generating test results, this file must not exist
e: After the test is completed, generate a test report
o: use In the path to store the test report

Note: result_report is a test report folder created by yourself. Before starting the command each time, the content of the folder must be cleared together with the jtl file, otherwise an error will be reported.

View test report

open index.html 

Guess you like

Origin blog.csdn.net/lzz718719/article/details/130951352