性能測試,如何獲得大量token,並保存在本地文件中

需求:性能測試須要大量的token,模擬登錄java

設計思路:python

一、使用語言:python +request+正則匹配+寫入本地shell

二、jmeter+函數助手+正則或者json/yaml+後置處理器beanshell寫入本地json

設計方法以下:函數

           一、使用fiddler,抓取註冊接口,驗證碼須要繞過性能

 

           二、使用函數助手-隨機函數測試

三、使用提取器,我使用的json/yaml,這個須要本身安裝插件plugins managers.net

四、 添加beanshell後置處理器,須要再本地建立E://123.csv文件,而後插件

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
String token=bsh.args[0];
try {
FileWriter fstream=new FileWriter("E:\\123.csv",true);
BufferedWriter out=new BufferedWriter(fstream);
out.write(vars.get("token")+"\n");
out.close();
fstream.close();
} catch (IOException e) {
e.printStackTrace();
}設計

  備註,當時寫這個beanshell腳本參考了這個博主,如今附上連接https://blog.csdn.net/qq_41767337/article/details/85336036

六、如今就能夠生成大量的token了,便於性能測試了

相關文章
相關標籤/搜索