一、核心命令解析
jmeter -g Dash_CapacityTest_01_AllModules_1000.jtl -o report/
參數?? ?作用?? ?
示例文件說明
-g?? ?指定.jtl結果文件路徑? ??
-o?? ?指定報告輸出目錄?? ?自動創建report文件夾
二、操作步驟(Windows/Linux/Mac通用)
進入JMeter安裝目錄的bin文件夾
執行生成命令
jmeter -g /完整路徑/Dash_CapacityTest_01_AllModules_1000.jtl -o ./report/
查看報告
打開生成的report/index.html文件
三、實戰示例
輸入文件結構
Dash_CapacityTest_01_AllModules_1000_0418142907-0418143907.jtl
├── timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success...
├── 1681812947070,345,HTTP Request,200,OK,Thread Group 1-1,text,true...
└── ...(1000個請求記錄)
生成報告內容
report/
├── content/
├── index.html ? ? ? ? # 主報告入口
├── sbadmin2-1.0.7/ ? ?# 樣式文件
└── statistics.json ? ?# 統計數據
四、常見問題排查
報錯現象 | 解決方案 |
Error generating report?? | 檢查.jtl文件是否包含有效測試數據 |
Output directory exists | 刪除或重命名已存在的report目錄 |
Permission denied | 使用管理員權限執行命令 |
?
五、注意事項
JMeter版本 ≥ 3.0(推薦使用5.6+)
確保.jtl文件是完整測試結果(非CSV格式需添加-l參數記錄)
報告文件占用空間約20MB/1000請求