Jmeter在命令行運行技巧
For non-interactive testing, you may choose to run JMeter without the GUI. To do so, use the following command options
-n This specifies JMeter is to run in non-gui mode
-t [name of JMX file that contains the Test Plan].
-l [name of JTL file to log sample results to].
-r Run all remote servers specified in JMeter.properties (or remote servers specified on command line by overriding properties)
The script also lets you specify the optional firewall/proxy server information:
-H [proxy server hostname or ip address]
-P [proxy server port]
Example : JMeter -n -t my_test.jmx -l log.jtl -H my.proxy.server -P 8000
-n 該參數表示Jmeter運行在非圖形化模式下(即命令行模式)。
-t 保存有測試用例的JMX文件
-l 保存樣本結果的JTL文件
-r 運行所有在JMeter.properties 中定義的遠程服務(或者通過命令行覆蓋配置文件中定義的遠程服務)。腳本還允許您指定可選的防火墻/代理服務器信息:
-H 代理服務器主機名或者IP地址
-P 代理服務器的端口號
上面這段說明來自 JMeter 的官方用戶手冊。其中提到了使用命令行方式運行 JMeter 腳本的方法。只有幾個簡單的參數,很直觀,用起來也很方便。好處是可以節省一些系統資源。
今天嘗試 300 個虛擬用戶連續運行 5 分鐘時——使用 GUI 方式,發現開始運行后不久 UI 就失去了響應,并提示一個有關 AWT 的錯誤,最終只能把 Java 進程結束掉。但是使用命令行方式時卻很穩定。
不過當在命令行方式下嘗試 500 個虛擬用戶連續運行 5 分鐘時,JMeter 拋出了一個 Out of Memory 的異常并退出了進程。
Note:
1.執行命令前要檢查當前目錄是否是 %JMeter_Home%\bin 目錄;
2.如果 JMeter 腳本不在當前目錄,需要指定完整的路徑;如果要把執行的結果保存在其他地方也要指定完整的路徑。
posted on 2014-09-26 10:11 順其自然EVO 閱讀(2713) 評論(0) 編輯 收藏 所屬分類: 測試學習專欄 、jmeter and badboy 、性能測試