您的位置:軟件測試 > 開源軟件測試 > 開源性能測試工具 > Jmeter
使用命令行方式運行JMeter腳本
作者:網絡轉載 發(fā)布時間:[ 2013/2/5 15:19:06 ] 推薦標簽:

2.4.3 Non-GUI Mode (Command Line mode)

    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

上面這段說明來自 JMeter 的官方用戶手冊。其中提到了使用命令行方式運行 JMeter 腳本的方法。只有幾個簡單的參數,很直觀,用起來也很方便。好處是可以節(jié)省一些系統資源。

嘗試 300 個虛擬用戶連續(xù)運行 5 分鐘時——使用 GUI 方式,發(fā)現開始運行后不久 UI 失去了響應,并提示一個有關  AWT 的錯誤,終只能把 Java 進程結束掉。但是使用命令行方式時卻很穩(wěn)定。
不過當在命令行方式下嘗試 500 個虛擬用戶連續(xù)運行 5 分鐘時,JMeter 拋出了一個 Out of Memory 的異常并退出了進程。

Note:
1.執(zhí)行命令前要檢查當前目錄是否是 %JMeter_Home%in 目錄;
2.如果 JMeter 腳本不在當前目錄,需要指定完整的路徑;如果要把執(zhí)行的結果保存在其他地方也要指定完整的路徑。

軟件測試工具 | 聯系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd