1、编写beanshell PostProcessor脚本
public static void getData(String file, String conent) {
BufferedWriter out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file, true)));
out.write(vars.get(conent)+"\r\n");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
getData("d:/test.csv", "token")
2、到本地文件d:/test.csv中去查看文件写入情况
写入情况与预期一致.
写入文件同样支持txt格式~需要的同学可以试试~