Load testing multipart form

Posted by JacobM on Stack Overflow See other posts from Stack Overflow or by JacobM
Published on 2009-12-22T16:03:29Z Indexed on 2010/04/09 11:03 UTC
Read the original article Hit count: 531

I'm trying to load-test a Rails application using JMeter. A critical part of the application involves a form that includes both text inputs and file uploads. It works fine in a browser, but when I try to post that page in JMeter, Rails is saving all of the parts of the multipart form as temp files, which causes things to break when it's looking for a string and gets a tempfile instead.

It appears that the difference is that, from a browser, the piece of the multipart request that contains a text input looks like this:

-----------------------------7d93b4186074c
Content-Disposition: form-data; name="field_name"

test
-----------------------------7d93b4186074c

while from JMeter it looks like this:

-----------------------------7d159c1302d0y0
Content-Disposition: form-data; name="field_name"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

test
-----------------------------7d159c1302d0y0

So apparently Rails sees the former and interprets it as a plain text value and treats it as a string, but sees the latter and saves it to a temp file.

I have not been able to find a setting to convince JMeter not to send the additional headers in the multipart form for non-file fields.

Is there a way to convince Rails to ignore those headers and treat the text/plain text as strings instead of text files? Or a quick way to put a filter in front of my controller that will strip the extra headers?

Alternately, is there a better tool to load-test a Rails application that includes file upload?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about multipartform-data