背景
1.一次壓力測試時,登錄接口tps較低,嚴重影響后續(xù)業(yè)務接口測試(使用token認證),故想到批量導出token,供其他接口使用;
2.性能壓測時,需要把一些響應結果部分字段匯總顯示
一、本地新建 csv 文件,并在腳本下方新建 BeanShell PostProcessor 后置處理器

test.csv

beanshell后置處理器
二、使用提取器提取目標數(shù)據(jù)
這里我使用的是json后置處理器,你也可以使用正則,提取到數(shù)據(jù)就行

image.png
三、編寫后置處理器腳本并調(diào)試

image.png
附腳本
FileWriter fstream = new FileWriter("C:\\Users\\zhanghao\\Desktop\\test.csv",true);
BufferedWriter out =new BufferedWriter(fstream);
out.write(vars.get("token"));
out.write(System.getProperty("line.separator"));
out.close();
fstream.close();
設置10個線程,跑一遍試試
完成

image.png