如何将Jmeter变量保存到csv文件
作者:互联网
有没有人知道如何将特定的Jmeter变量保存到csv文件中?
我已经尝试过这个主题没有成功:Write extracted data to a file using jmeter和这段代码:
FileWriter fstream = new FileWriter("result.csv",true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(${account_id});
out.close();
谢谢.
解决方法:
>替换你的out.write(${account_id});带有out.write的节(vars.get(“account_id”));
>最好关闭fstream实例以避免打开句柄缺乏
>如果您要重复使用此文件,即存储> 1变量,添加一个分隔符,即新行
最终代码:
FileWriter fstream = new FileWriter("result.csv",true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(vars.get("account_id"));
out.write(System.getProperty("line.separator"));
out.close();
fstream.close();
有关Beanshell脚本编制的全面信息,请参见How to use BeanShell: JMeter’s favorite built-in component
标签:beanshell,jmeter-plugins,javascript,java,jmeter 来源: https://codeday.me/bug/20191006/1859583.html