1
votes

I am having problems trying to upload a file in JMeter 3.1. In the HTTP Request, I have a POST request with the "User multipart/form-data for POST" option checked. Then I have File Path, Parameter Name and MIME type set, no problems there.

The issue is that the script is working on JMeter 2.13, but it keeps failing when running either on 3.0 or 3.1. The response code is 200, but it fails on the expected text "File successfully uploaded".

The only difference between 2.13 and 3.1 is that 3.1 adds the charset value on the Conent-Type Request Header (please find attached screenshots).

JMeter 2.13

Jmeter 3.1

Thanks in advance!

1
What is your assertion config? Also, check the path of the file in "File Path".NaveenKumar Namachivayam
In the assertion I am just validating the response message, no issues there. And the path of the file is ok, because if not, I would get FileNotFoundException and this is not the case.uru917

1 Answers

1
votes

My expectation is that you have different HTTP Client Implementations

HTTP Request this has an implementation drop-down box, which selects the HTTP protocol implementation to be used:

Java uses the HTTP implementation provided by the JVM. This has some limitations in comparison with the HttpClient implementations - see below.

HTTPClient3.1 (DEPRECATED SINCE 3.0) uses Apache Commons HttpClient 3.1. This is no longer being developed, and support for this will be dropped in a future JMeter release.

HTTPClient4 uses Apache HttpComponents HttpClient 4.x.

Blank Value does not set implementation on HTTP Samplers, so relies on HTTP Request Defaults if present or on jmeter.httpsampler property defined in jmeter.properties

Make sure you are using the same for both JMeter versions and you will get the same behaviour. If the value is blank you can check jmeter.httpsampler property value in jmeter.properties and/or user.properties files.

You can quickly change the implementation for all the samplers using HTTP Request Defaults.