jmeter-00 JMeter 运行过程
一.GUI mode 圖形化界面運行
to run JMeter, run the?jmeter.bat?(for Windows) or?jmeter?(for Unix) file. These files are found in the bin directory.?
?
windows中,bin目錄下可用腳本有:
jmeter.bat
run JMeter (in GUI mode by default)
jmeterw.cmd
run JMeter without the windows shell console (in GUI mode by default)
jmeter-n.cmd
drop a JMX file on this to run a non-GUI test
jmeter-n-r.cmd
drop a JMX file on this to run a non-GUI test remotely
jmeter-t.cmd
drop a JMX file on this to load it in GUI mode
jmeter-server.bat
start JMeter in server mode
mirror-server.cmd
runs the JMeter Mirror Server in non-GUI mode
shutdown.cmd
Run the Shutdown client to stop a non-GUI instance gracefully
stoptest.cmd
Run the Shutdown client to stop a non-GUI instance abruptly
?
Linux/Unix?中,bin目錄下可用腳本有:
jmeter
run JMeter (in GUI mode by default). Defines some JVM settings which may not work for all JVMs.
jmeter-server
start JMeter in server mode (calls jmeter script with appropriate parameters)
jmeter.sh
very basic JMeter script (You may need to adapt JVM options like memory settings).
mirror-server.sh
runs the JMeter Mirror Server in non-GUI mode
shutdown.sh
Run the Shutdown client to stop a non-GUI instance gracefully
stoptest.sh
Run the Shutdown client to stop a non-GUI instance abruptly
?
二.Non-GUI mode(?Command-line mode) 非圖形化界面運行?
For load testing, you must run JMeter in this mode
命令選項有:
D:\apache-jmeter-3.3\bin>jmeter -?_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____/ \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \/ _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) |/ ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ < /_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 3.3 r1808647Copyright (c) 1999-2017 The Apache Software Foundation--?print command line options and exit-h, --helpprint usage information and exit-v, --versionprint the version information and exit-p, --propfile <argument>the jmeter property file to use-q, --addprop <argument>additional JMeter property file(s)-t, --testfile <argument>the jmeter test(.jmx) file to run. "-t LAST" will load lastused file-l, --logfile <argument>the file to log samples to-i, --jmeterlogconf <argument>jmeter logging configuration file (log4j2.xml)-j, --jmeterlogfile <argument>jmeter run log file (jmeter.log)-n, --nonguirun JMeter in nongui mode-s, --serverrun the JMeter server-H, --proxyHost <argument>Set a proxy server for JMeter to use-P, --proxyPort <argument>Set proxy server port for JMeter to use-N, --nonProxyHosts <argument>Set nonproxy host list (e.g. *.apache.org|localhost)-u, --username <argument>Set username for proxy server that JMeter is to use-a, --password <argument>Set password for proxy server that JMeter is to use-J, --jmeterproperty <argument>=<value>Define additional JMeter properties-G, --globalproperty <argument>=<value>Define Global properties (sent to servers)e.g. -Gport=123or -Gglobal.properties-D, --systemproperty <argument>=<value>Define additional system properties-S, --systemPropertyFile <argument>additional system property file(s)-f, --forceDeleteResultFileforce delete existing results files before start the test-L, --loglevel <argument>=<value>[category=]level e.g. jorphan=INFO, jmeter.util=DEBUG or com.example.foo=WARN-r, --runremoteStart remote servers (as defined in remote_hosts)-R, --remotestart <argument>Start these remote servers (overrides remote_hosts)-d, --homedir <argument>the jmeter home directory to use-X, --remoteexitExit the remote servers at end of test (non-GUI)-g, --reportonly <argument>generate report dashboard only, from a test results file-e, --reportatendofloadtestsgenerate report dashboard after load test-o, --reportoutputfolder <argument>output folder for report dashboard舉例:
jmeter -n -t my_test.jmx -l log.jtl -H my.proxy.server -P 8000?
GUI mode should only be used for creating the test script, NON GUI mode must be used for load testing
?
三、分布式運行
(1)控制機:也可以參與腳本的運行,同時它也擔負著管理遠程負載機指揮遠程負載機運行的任務,并且收集遠程負載機的測試結果。
(2)負載機:向被測應用服務器發起負載的機器。負載機首先要啟動一個客戶端程序(Agent:jmeter-server.bat),這樣控制機才能接管負載機。控制機會把運行的腳本隱蔽地發送到遠程負載機,但是如果運行的測試腳本有參數文件及依賴的jar包時,控制機并不能把它們發送到遠程負載機,這種情況就需要手動拷貝了。
(3)遠程運行邏輯:
遠程負載機首先啟動Agent程序,待控制機連接;
控制機連接上遠程負載機;
控制機發送指令(腳本及啟動命令)啟動線程;
負載機運行腳本,回傳狀態(包括測試結果)
控制機收集結果并顯示。
?
舉例:在10.1.102.68 機器中啟動jmeter 作為控制機,在10.1.102.75 機器中啟動jmeter作為負載機。
方式一:控制機以GUI方式運行
1.首先在68 jmeter 的jmeter.properties 中指定"remote_hosts" (修改了jmeter.properties 文件需要重新啟動JMeter才可以生效)
# Remote Hosts - comma delimited remote_hosts=10.1.102.75 #remote_hosts=localhost:1099,localhost:20102.在75 中,啟動JMeter Agent 程序,如
3. 在68中,啟動jmeter,做一個簡單配置,如下:
點擊遠程全部啟動即可。
?此時如果正常運行,則75中的agent 控制臺中輸出如下:
?
?方式二:控制機通過非GUI方式運行
1. 配置測試計劃
2.?在75 中,啟動JMeter Agent 程序,如
3. 在68中, 命令行執行如下:
D:\apache-jmeter-3.3\bin>jmeter -n -t F:\jmeter_workspace\測試計劃-遠程運行實例.jmx -l F:\jmeter_workspace\remote.jtl -R 10.1.102.75 Creating summariser <summary> Created the tree successfully using F:\jmeter_workspace\測試計劃-遠程運行實例.jmx Configuring remote engine: 10.1.102.75 Starting remote engines Starting the test @ Fri Nov 03 17:19:54 CST 2017 (1509700794827) Remote engines have been started Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445此時如果正常運行,則75中的agent 控制臺中輸出如下:
?
?四、通過命令行覆蓋屬性配置
Java system properties and JMeter properties can be overridden directly on the command lin (instead of modifying?jmeter.properties). To do so, use the following options:
-D[prop_name]=[value]
defines a java system property value.
-J[prop_name]=[value]
defines a local JMeter property.
-G[prop_name]=[value]
defines a JMeter property to be sent to all remote servers.
-G[propertyfile]
defines a file containing JMeter properties to be sent to all remote servers.
-L[category]=[priority]
overrides a logging setting, setting a particular category to the given priority level
?舉例:
jmeter -Duser.dir=/home/mstover/jmeter_stuff -Jremote_hosts=127.0.0.1 -Ljmeter.engine=DEBUG實例:從命令行中,指定運行線程數與url
命令行執行命令:
jmeter -n -t "mock_api .jmx" -JthreadCount=5 -Durl=10.1.102.75?
五、命令行選項與properties配置的處理順序
?
***微信掃一掃,關注“python測試開發圈”,了解更多測試教程!***轉載于:https://www.cnblogs.com/guanfuchang/p/7779371.html
總結
以上是生活随笔為你收集整理的jmeter-00 JMeter 运行过程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: FONT Awesome 图标
- 下一篇: 命名函数表达式探秘