您的位置:軟件測(cè)試 > 開(kāi)源軟件測(cè)試 > 開(kāi)源性能測(cè)試工具 > Jmeter
使用命令行方式運(yùn)行JMeter腳本
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:[ 2013/2/5 15:19:06 ] 推薦標(biāo)簽:

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

上面這段說(shuō)明來(lái)自 JMeter 的官方用戶手冊(cè)。其中提到了使用命令行方式運(yùn)行 JMeter 腳本的方法。只有幾個(gè)簡(jiǎn)單的參數(shù),很直觀,用起來(lái)也很方便。好處是可以節(jié)省一些系統(tǒng)資源。

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

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

軟件測(cè)試工具 | 聯(lián)系我們 | 投訴建議 | 誠(chéng)聘英才 | 申請(qǐng)使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd