JMeter - 文件上传和文件下载场景 [英] JMeter - File upload and file download scenario

查看:17
本文介绍了JMeter - 文件上传和文件下载场景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 JMeter 对网页进行性能测试.我有一个上传文件和下载文件的场景.我需要加载测试上传文件和下载文件场景.

任何人都可以帮助我如何使用 JMeter 实现这些.

谢谢,拉杰

解决方案

使用任何 HTTP 嗅探工具记录上传/下载流量,然后使用 jmeter 模拟记录的请求实际上没有任何困难.

在最简单的情况下,您将得到如下内容:

  • 用于设置测试用户数和循环数的线程组;
  • 上传:1 个 http POST 请求,使用 multipart/form-data for POST = true - 作为 request;
  • 下载:1 个 http GET 下载请求 + 保存对文件的响应 附加到它的侦听器 - 保存请求的文件.

这将如下所示:

<前>线程组线程数 = X循环计数 = Y...上传 HTTP 请求方法 = POST使用 multipart/form-data for POST = true-- 随请求发送文件 -- 部分:文件路径 = ${testFile}参数名称 = 数据文件MIME 类型 = ......下载 HTTP 请求方法 = GET将回复保存到文件文件名前缀 = downloadTest_变量名 = testFile...

在这里你可以找到为上面给出的模式实现的示例脚本:文件上传下载.jmx.

<小时>

以下帖子也可能有用:

<小时>

您还可以使用自定义jmeter-plugins.
这两个似乎非常适合您的测试:

I am using JMeter to do performance test a web page. I have a scenario for uploading a file and downloading a file. I need to load test uploading file and downloading file scenarios.

Can any one help me how to achieve these using JMeter.

Thanks, Raj

解决方案

There are actually no difficulties in recording upload/download traffic with any HTTP sniffing tool and then emulate recorded requests in using jmeter.

In the simplest case you will get something like the following:

  • Thread Group to setup number of test users and loops;
  • for upload: 1 http POST request with Use multipart/form-data for POST = true - to sent file as part of request;
  • for download: 1 http GET request for download + Save Responses to a file listener attached to it - to save requested file.

This will look like the following:

Thread Group
Number of Threads = X
Loop Count = Y
    . . .
    UPLOAD HTTP Request
    Method = POST
    Use multipart/form-data for POST = true
    -- Send Files with Request -- section:
    File Path = ${testFile}
    Parameter Name = datafile
    MIME Type = ...
    . . .
    DOWNLOAD HTTP Request
    Method = GET
        Save Responses to a file
        Filename Prefix = downloadTest_
        Variable Name = testFile
    . . .

Here you can find sample script implemented for schema given above: file-upload-download.jmx.


The following posts may also appear useful:


You can also use custom jmeter-plugins.
These two seem extremely suitable for your tests:

这篇关于JMeter - 文件上传和文件下载场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆