使用Jmeter测试下载文件(http响应具有下载链接) [英] Test download a file using Jmeter (the http response has download link)
问题描述
测试使用Jmeter下载文件":在网页上,有一个下载"按钮,单击该按钮将下载扩展名为.zip的文件.在开发人员工具(F12)"的网络"选项卡下观察到时,有两个请求:1是应用程序请求,该请求通过链接(aws-S3 ...)给出响应(如果我复制粘贴此链接,则可以下载zip文件)第二个请求显示aws-S3..link.当需要与100个用户一起执行此下载性能测试时,如何在Jmeter中进行配置.请指导.下面的东西已经尝试过:
Test 'download a file using Jmeter': On the web page, there is a button 'download' and clicking it downloads the file with .zip extension. When observed under Network tab of Developer tool (F12)>there are two requests: 1 is the application request which gives the response with link (aws-S3...) (if i copy paste this link, can download the zip file) and 2nd request shows the aws-S3..link. When need to perform this download performance testing with 100 users, how to configure in Jmeter. Please guide. below thing have been tried:
- 记录脚本>它记录第一个请求(而不是如上所述的网络"标签的第二个请求)
- 运行脚本时>显示200条代码,响应消息为aws-S3..link
- 尝试将响应保存到文件侦听器>未下载任何内容.
推荐答案
- Extract the download link from 1st response using i.e. Regular Expression Extractor
- Add put the JMeter Variable generated by the Regular Expression Extractor into "Path" input of the HTTP Request 2
Add Save Responses to a file listener as a child of the HTTP Request 2
请参见性能测试:上传和下载使用Apache JMeter的场景文章,以获得有关在JMeter Web测试中模拟文件上传/下载事件的更多信息.
See Performance Testing: Upload and Download Scenarios with Apache JMeter article for more information on simulating file upload/download events in JMeter web tests.
这篇关于使用Jmeter测试下载文件(http响应具有下载链接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!