5

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?

1

2 Answers 2

6

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

This is related to the defect mentioned above. But the workaround is (On windows) to place the file that is being uploaded in the same folder as the JMX file is. (The file path is not captured only the file name is captured here. Hence need to update the correct absolute or relative path accordingly once the requests are captured.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.