Jmeter上传录制错误 [英] Jmeter Upload Error in Recording

查看:75
本文介绍了Jmeter上传录制错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试录制具有上传功能的会话.
我已经使用 http 代理服务器进行录制、录制控制器和 http cookie 管理器.
当我尝试上传文件并单击保存时,它显示以下错误:

<块引用>

java.io.FileNotFoundException: a12-13538_110q.htm(系统不能在 java.io.FileInputStream.open(Native方法)在 java.io.FileInputStream.(Unknown Source) atjava.io.FileInputStream.(Unknown Source) atorg.apache.jmeter.protocol.http.sampler.PostWriter.writeFileToStream(PostWriter.java:408)在org.apache.jmeter.protocol.http.sampler.PostWriter.sendPostData(PostWriter.java:117)在org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sendPostData(HTTPJavaImpl.java:115)在org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(HTTPJavaImpl.java:510)在org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)在org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1060)在 org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:238)

当我不使用 jmeter 记录时,此功能工作正常.

请对此提供帮助.
有什么办法可以执行此测试吗?

解决方案

Bug 50079:Jmeter不记录文件路径.

根据您的异常,由于上述问题,jmeter 无法找到要上传的文件.
所以你必须在采样器中手动设置路径,为此最好使用变量,用于测试参数化.

根本不要使用录音和回放,或者至少检查和调整您录制的采样器.
在您的情况下,您必须在记录的 http [POST] 请求中设置以下内容:

  • 使用 multipart/form-data for POST = true - 作为请求的一部分发送文件;
  • 使用请求发送文件 ->文件路径 = PATH_TO_FILE - 存在文件的路径,直接或使用变量.
<前>...上传 HTTP 请求方法 = POST使用 multipart/form-data for POST = true-- 随请求发送文件 -- 部分:文件路径 = ${testFile}参数名称 = 数据文件MIME 类型 = ......

I am trying to record a session in which there is a upload functionality.
I have used http proxy server for recording, recording controller and http cookie manager.
When I try to upload a file and click save it shows following error:

java.io.FileNotFoundException: a12-13538_110q.htm (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(Unknown Source) at java.io.FileInputStream.(Unknown Source) at org.apache.jmeter.protocol.http.sampler.PostWriter.writeFileToStream(PostWriter.java:408) at org.apache.jmeter.protocol.http.sampler.PostWriter.sendPostData(PostWriter.java:117) at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sendPostData(HTTPJavaImpl.java:115) at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(HTTPJavaImpl.java:510) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1060) at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:238)

This functionality works fine when I am not using jmeter recording.

Kindly help on this.
Is there any way I can perform this test?

解决方案

Bug 50079: Jmeter does not record the file path.

As per your exception jmeter cannot find file to upload, because of issue mentioned above.
So you have to set path manually in sampler, and it's better to use variable for this, for test parametrization.

Don't use record-and-playback at all, or at least check and adjust your recorded samplers.
In your case you have to set in recorded http [POST] request following:

  • Use multipart/form-data for POST = true - to sent file as part of request;
  • Send Files with Request -> File Path = PATH_TO_FILE - path to existent file, directly or using variable.

    . . .
    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 = ...
    . . .

这篇关于Jmeter上传录制错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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