irisWhq

Jmeter生成CSV文件report

1. 首先日期格式化

@echo off
echo %DATE%%TIME%
set datef=%date:~0,4%%date:~5,2%%date:~8%

2. 如果文件夹存在就delete掉

rd /s /q "<reportSavePath>\Aggregate_report_%datef%"

3. 创建文件夹

md "<reportSavePath>\Aggregate_report_%datef%"

4. 执行Jmeter命令,将JTL转为CSV

PS: 这里要下载一个cmdrunner-2.2.jar 放到JmeterHome\lib下

cd <Jmeter_home_path>\lib
java -jar cmdrunner-2.2.jar --tool Reporter --generate-csv <reportSavePath>\Aggregate_report_%datef%\Aggregate_report_%datef%.csv --input-jtl <reportSavePath>\jtl_%datef%\jtl_%datef%.jtl --plugin-type AggregateReport

总结完整的脚本(jmeterTest02.bat)如下:

@echo off
echo %DATE%%TIME%
set datef=%date:~0,4%%date:~5,2%%date:~8%
rd /s /q "<reportSavePath>\Aggregate_report_%datef%"
md "<reportSavePath>\Aggregate_report_%datef%"
cd <Jmeter_home_path>\lib
java -jar cmdrunner-2.2.jar --tool Reporter --generate-csv <reportSavePath>\Aggregate_report_%datef%\Aggregate_report_%datef%.csv --input-jtl <reportSavePath>\jtl_%datef%\jtl_%datef%.jtl --plugin-type AggregateReport

 

posted on 2020-10-10 18:03  irisWhq  阅读(589)  评论(0编辑  收藏  举报

导航