zoukankan      html  css  js  c++  java
  • jmeter文件下载

    阐述:1.本次下载先发送htttp请求,然后执行Beanshell sampler中的脚本,将图片保存下来;

       2.beanshell sampler用到的脚本:

          import java.io.*;
          byte[] result = prev.getResponseData();  //这个是获取到请求返回的数据,prev是获取上个请求的返回
          String file_name = "E:\besttest\xx.jpg"; //代表存放文件的位置和文件名
          File file = new File(file_name);
          FileOutputStream out = new FileOutputStream(file);
          out.write(result);
          out.close();

    1.选中测试计划右键添加线程组:测试计划->添加->Threads->线程组(线程组名称可以根据所做项目自行修改)

    2.选中线程组右键添加HTTP请求:线程组->Sample->HTTP请求

    3.选中线程组右键添加BeanShell Sampler:线程组->Sample->BeanShell Sampler

    4.点击执行,查看结果树可以看见图片已经获取到;

    5.保存的路径中已经下载下改图片

    人生的旅途,前途很远,也很暗。然而不要怕,不怕的人的面前才有路。
  • 相关阅读:
    CSS 基础(一)
    74.Search a 2D Matrix
    73.Set Matrix Zeroes
    66.Plus One
    64.Minimum Path Sum
    63.Unique Paths II
    62.Unique Paths
    54.Spiral Matrix
    59.Spiral Matrix II
    55.Jump Game
  • 原文地址:https://www.cnblogs.com/ymany/p/8556224.html
Copyright © 2011-2022 走看看