1. 程式人生 > 實用技巧 >jmeter在non-GUI模式下用法

jmeter在non-GUI模式下用法

用法

jmeter -n -t HTTPRequesttest.jmx -l testHistory/testResult.jtl -e -o testHistory/testReport

引數說明

-n :以非GUI形式執行Jmeter

-t :source.jmx 指令碼路徑

-l :執行結果儲存路徑(.jtl),此檔案必須不存在

-e :在指令碼執行結束後生成html報告

-o :儲存html報告的地址, 此檔案以及檔案目錄必須不存在

實時檢視壓測結果

配置

jmeter命令列下,也可以實時檢視壓測結果,只需要修改配置檔案bin目錄下jmeter.properties。

# Summariser - Generate Summary Results - configuration (mainly applies to non-GUI mode)
#---------------------------------------------------------------------------
#
# Define the following property to automatically start a summariser with that name
# (applies to non-GUI mode only)
# summariser.name=summary
#
# interval between summaries (in seconds) default 30 seconds
# summariser.interval=30 //這個表示統計頻率
#
# Write messages to log file
# summariser.log=true
#
# Write messages to System.out
# summariser.out=true //是否將統計結果輸出到控制檯

結果輸出

Creating summariser <summary>
Created the tree successfully using HTTPRequesttest.jmx
Starting standalone test @ Sat Jun 27 16:15:48 CST 2020 (1593245748891)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary = 500 in 00:00:03 = 157.7/s Avg: 1601 Min: 261 Max: 2796 Err: 0 (0.00%)
Tidying up ... @ Sat Jun 27 16:15:52 CST 2020 (1593245752465)
... end of run

html測試報告

測試結束後,我們在我們自己指定的檔案目錄下可以看到生成的html報告相關的檔案,報告內容如下

Dashboard

Test and Report informations

測試和報告資訊: 測試結果儲存檔案/測試開始時間/測試結束時間/展示過濾器。

APDEX(Application Performance Index)

應用程式效能滿意度的標準,範圍在 0-1之間,1表示達到所有使用者均滿意,可以在配置檔案設定

Requests Summary: 請求的通過率(OK)與失敗率(KO),百分比顯示。

Statistics: 資料分析,基本將 Summary Report 和 Aggrerate Report 的結果合併。

Errors: 錯誤情況,依據不同的錯誤型別,將所有錯誤結果展示。

Charts

用圖表的形式展示測試資料,讓測試報告更加 直觀。

特點:

將測試過程中 經常使用的資料,用圖表的形式展示,讓測試結果更加直觀

每個圖表資料,有兩種展示形式。

支援請求樣例過濾顯示

支援匯出 PNG圖片格式

Over Time

Response Times Over Time: 響應時間

Bytes Throughput Over Time: 位元組 接收/傳送的數量

Latencies Over Time: 延遲時間

Throughput

Hits Per Second: 每秒點選率

Codes Per Second: 每秒狀態碼數量

Transactions Per Second: 每秒事務量

Response Time Vs Request: 響應時間點請求的 成功/失敗數

Latency Vs Request: 延遲時間點請求的 成功/失敗數

Response Times

Response Time Percentiles: 響應時間百分比

Active Threads Over Time: 啟用執行緒數

Time Vs Threads: 測試過程中的執行緒數時續圖

Response Time Distribution: 響應時間分佈

參考資料

命令列模式執行jmeter,主從方式執行jmeter