jmeter:文件下载连接请求保存文件

1、添加HTTP请求:

  

 如图下载exe格式的文件

2、添加BeanShell PostProcessor

  添加察看结果树,发送请求,查看返回请求,如图,发回的时字节流的字符串,我们需要将这些字符串导入文件中,再将文件改为exe格式即可

通过后置处理器:BeanShell PostProcessor来导入(记得在HTTP请求下添加):

import java.io.*;
byte[] result = prev.getResponseData();
String file_name = "D:/a.exe";
File file = new File(file_name);
FileOutputStream out = new FileOutputStream(file);
out.write(result);
out.close();

3、发送请求:

 打开目录:

原文地址:https://www.cnblogs.com/fengliting/p/13293791.html