Jmeter 自动生成Html 测试报告

String time = vars.get("nowtime");

String today = vars.get("today");
String todayTime = vars.get("todayTime");

 

log.info(time);
log.info(today);

 

String root = "E:\\00-xxx\\result\\";
String reportPath = root + today + "\\" + todayTime;
File dir = new File(reportPath);
if (!dir.exists()) {
dir.mkdir();
}
String report = root + "\\Aggregate-Report-" + vars.get("nowtime");
String jmeterPath = "E:\\00-xxx\\soft\\apache-jmeter-5.3\\bin\\jmeter.bat";
String cmd = jmeterPath + " -g " + report + ".jtl -o " + reportPath;

 

log.info(cmd);
log.info("Html Report Path is : [" + reportPath + "]");

 

try {
Runtime.getRuntime().exec(cmd);
} catch (Exception e) {
log.error(e.getMessage());
}

 

上一篇:jmeter全局变量设置


下一篇:【jmeter--提取参数保存到本地csv】