在 JMeter 中下载并保存文件
有没有办法在 JMeter 中配置来保存来自响应的文件?
在对话框中选择“保存文件”?
Is there any way to configure in JMeter to save the files coming from a response?
In the dialog box, choose 'save file'?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经为这个问题苦苦挣扎了一个星期,终于找到了解决方案。
您需要添加一个监听器“保存对文件的响应”,该请求仅获取文件,然后给出您想要保存文件的位置。
Jmeter保存2个文件,一个包含响应结果,另一个是原始文件。
文件格式与从数据库中获取的文件格式相同,在我的情况下,jmeter 在该位置保存的文件名是“TEXTFILE_1.octet-stream”。
将此文件重命名为原始格式,如 file.jpg 或任何格式。
您将获得原始文件,为了检查文件完整性、数据丢失和数据损坏,可以对从 jmeter 获取的文件和上传之前的文件进行 CRC 检查 - 文件的 CRC 值应该相同。
希望有帮助。
I have been struggling with issue for a week and finally got the solution.
You need to add a Listener "Save response to a file" with that request only that fetches file and then give a location where u want to save the file.
Jmeter saves 2 files one contains response Result and other is the original file.
File format is same as what is fetched from database well in my case the file name that is saved by jmeter on the location is "TEXTFILE_1.octet-stream".
Rename this file to original format like file.jpg or whatever is the format.
You will get the original file and for checking the file integrity, data loss and data corruption, CRC check can be done for the file obtained from jmeter and file before upload - CRC value for the file should be same.
Hope it helps.
要通过单击应用程序中的“下载”按钮从服务器检索文件,请在 JMETER 中单击“下载嵌入内容”框,或者使您的请求直接指向您要下载的文件。您可能需要在页面上执行正则表达式来获取文件位置,然后仅为可下载文件创建单独的响应。
To retrieve files from the server by clicking the "download" button in your app, in JMETER click the box "download embedded content" OR make your request point directly to the file you are trying to download. You may need to do a regex on the page to get the file location and then create a separate response just for the downloadable file.
您是否尝试过使用将响应保存到文件?如果您的采样器访问您尝试下载的文件的 URL,它应该保存内容。我自己没有尝试过,但是 此线程似乎表明它应该可以工作。
Have you tried using Save Responses to File? If your sampler accesses the URL of the file you're trying to download, it should save the content. I haven't tried it myself, but dialog in this thread seems to indicate that it should work.