Re: [Grinder-use] grinder support for file upload

James Liang <[email protected]> Fri, 2 Dec 2011 19:26:17 -0500
Newsgroups gmane.comp.java.grinder.devel,gmane.comp.java.grinder.user
Message-ID <66360B3D135282408759C4D50104FB326B0C0DA5D2@mercury.utopiasystems.net>
I take back what I said about upload being broken.  After doing stuff the hard way and spent quite a bit of time at it, I've figure it out.  Maybe this stuff is in the reference doc but I didn't see it.

The proxy support for file upload does work.  I am writing this here so that the next guy who search for this issue will find it.

For file upload, the grinder proxy writes the uploaded data into a local file.  Look for setDataFromFile() in the generated script.  The data is not inline into the py script which makes a lot of sense.

request501 = HTTPRequest(url=url0, headers=headers17)
request501.setDataFromFile('http-data-0.dat')
request501 = Test(501, 'POST docupload.seam').wrap(request501)

Also becareful with non standard file upload widgets like Flash (ugh).  The grinder proxy doesn't seem to support these.

Thanks,
James Liang

From: James Liang
Sent: Wednesday, November 30, 2011 12:47 PM
To: 'grinder-use'; 'grinder-development-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org'
Subject: RE: [Grinder-use] grinder support for file upload

Grinder proxy support for file upload appears broken in grinder-3.6.

Using wireshark, I verified the test server I am uploading a file (contains a bunch of 'A') is following rfc 1867 http file upload spec.

However, the generated the proxy generated py script did not contain any of the file data.  I was expecting the multipart submit to be part of the generated script.

  def page1(self):
    """POST appfile.seam (request 101)."""
    result = request101.POST('/oflows/oconsole/appfile.seam',
      'AJAXREQUEST=_viewRoot&docupload=docupload&docupload%3Aupload%3Afile=test.jpg&docupload%3Aupload%3Afile=&javax.faces.ViewState=j_id4&docupload%3Aupload=docupload%3Aupload&ajaxSingle=docupload%3Aupload&_richfaces_upload_uid=0.7842636289930416&_richfaces_file_upload_action=progress&AJAX%3AEVENTS_COUNT=1&',
      ( NVPair('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'), ))
    self.token_javaxfacesViewState = \
      httpUtilities.valueFromHiddenInput('javax.faces.ViewState') # 'j_id4'

    return result


Wireshark shows the http traffic (formating slightly off) is this:

POST /oflows/oconsole/appfile.seam?_richfaces_upload_uid=0.915415757787077&docupload:upload=docupload:upload&_richfaces_upload_file_indicator=true&AJAXREQUEST=_viewRoot HTTP/1.1
Host: provident.console.oflows.us
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1) Gecko/20100101 Firefox/8.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Referer: http://provident.console.oflows.us/oflows/oconsole/appfile.seam?appId=3&cid=256&conversationPropagation=join
Cookie: JSESSIONID=62F66A70B99AA9F611807904B20049E6
Content-Type: multipart/form-data; boundary=---------------------------491299511942

Content-Length: 19393

-----------------------------491299511942

Content-Disposition: form-data; name="docupload"



docupload

-----------------------------491299511942

Content-Disposition: form-data; name="docupload:upload:file"; filename="test.jpg"


Content-Type: image/jpeg


AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
....
[more stuff]



Thanks,
James Liang

From: Carlos E. Torchia [mailto:ctorchia-a84/LA3/[email protected]]
Sent: Tuesday, November 29, 2011 9:28 PM
To: grinder-use
Subject: Re: [Grinder-use] grinder support for file upload

I am on Grinder 3.5.  Have you tried recording an upload of a file to a different site? Is it possible your web app is doing fancy stuff with JavaScript and not really sending the file as form data, but encoding and sending it in separate requests?
On Tue, Nov 29, 2011 at 11:57 PM, James Liang <[email protected]<mailto:[email protected]>> wrote:
Thanks Carlos.

I am surprise this worked for you.  I've did a capture and I can see the POST request in the generated script.  However, the data from file is not there.  There is no multi part form data in the generated py script.

What version of Grinder are you using?  I am on grinder-3.6.

Thanks,
James Liang

From: Carlos E. Torchia [mailto:ctorchia-a84/LA3/[email protected]<mailto:ctorchia-a84/LA3/[email protected]>]
Sent: Tuesday, November 29, 2011 8:24 PM
To: grinder-use
Subject: Re: [Grinder-use] grinder support for file upload

I recorded a test that involves a file upload. It's just multi-part form data, with the data of the file and the entire POST request represented as a string in the Jython code.

E.g. suppose you have a file with HELLO_WORLD in it. Then the proxy server would record something like:

request1234.POST('/hello-world', '<bunchastuff>HELLO_WORLD<bunchastuff>')

hope this helps
On Tue, Nov 29, 2011 at 6:32 PM, James Liang <[email protected]<mailto:[email protected]>> wrote:
Hi all,

Does the grinder proxy tool support the capturing of file uploads?   I need to load test a file upload function of the system.  Any advice on using grinder for this purpose?

Thanks,
James Liang


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
grinder-use mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/grinder-use


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
grinder-use mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/grinder-use

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d

_______________________________________________
Grinder-development mailing list
Grinder-development-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/grinder-development