beanshell
1.无论是QQ还是微信,传输的都是二进制流;
2.写入文件的代码:
FileWriter fstream = new FileWriter("D:\\\name.txt",false); //true代表追加写入,false代表覆盖;
BufferedWriter out = new BufferedWriter(fstream);
out.write("http://123.56.170.43:8888"+vars.get("src_${num}"));
out.write(System.getProperty("line.separator"));
out.close();
fstream.close();
3.prev.getResponseData的作用是获取当前sample的响应code,获取
import org.apache.jmeter.samplers.SampleResult;
SampleResult result = ctx.getPreviousResult();
String req_headers = result.getRequestHeaders();
log.info("-------请求头是------");
log.info(req_headers);
String res_headers = result.getResponseHeaders();
log.info("-------响应头是------");
log.info(res_headers);
String response_code = result.getResponseCode();
log.info("-------响应代码是------");
log.info(response_code);
String start = props.get("START.NS");
//props.put("ABC","123")
log.info("-------------");
log.info(start);