JMeter-文件上传和文件下载场景 [英] JMeter - File upload and file download scenario
问题描述
我正在使用JMeter对网页进行性能测试. 我有一个上载文件和下载文件的方案.我需要加载测试上传文件和下载文件的方案.
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.
任何人都可以帮助我如何使用JMeter实现这些目标.
Can any one help me how to achieve these using JMeter.
谢谢, 拉吉
推荐答案
使用任何HTTP嗅探工具记录上载/下载流量,然后使用jmeter模拟记录的请求,实际上并没有困难.
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:
- 用于设置测试用户和循环数量的线程组;
- 用于上传:1个带有使用multipart/form-data进行POST的HTTP POST请求= true -将文件作为保存对文件的响应附加到该文件的侦听器-保存请求的文件.
- 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.
如下所示:
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
. . .
在这里您可以找到为上述架构实施的示例脚本:文件上传下载.jmx .
Here you can find sample script implemented for schema given above: file-upload-download.jmx.
以下帖子也可能会有用:
The following posts may also appear useful:
- Testing load document functionality with JMeter.
- Performance testing: Upload and Download Scenarios with Apache JMeter
- How to Test Image Upload Functionality With JMeter
- JMeter Testing Multiple Random File Uploads
- Handling File Upload in JMeter
您还可以使用自定义 jmeter插件.
这两个似乎非常适合您的测试:
You can also use custom jmeter-plugins.
These two seem extremely suitable for your tests:
- Response Times Over Time
- Bytes Throughput Over Time
这篇关于JMeter-文件上传和文件下载场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!