Search the web
Sign In
New User? Sign Up
Advanced-LoadRunner
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Parameterizing uploaded files   Message List  
Reply | Forward Message #1079 of 1092 |
Re: Parameterizing uploaded files

> My issue is that I need to parameterize some values in the files that
> get uploaded. Any idea of how to do that? I could create a large
> number of unique files then parameterize the file name in the
> web_submit_data, but that is a pain.

One way would be to use C file handling functions to open and modify
the file with the parameters before uploading it. But depending on how
much you need to modify the file (you may have to seek to the right
place in file and then replace/append the parameter) and how many
users will be simultaneously running during the load test, it can
potentially cause too much disk usage on your agent machines.

> Better still, would be if there is a way simply generate a string in
> memory them pass it to the POST so that it looks like it is attached as
> a multipart/form-data.

It may be possible to create a manual web_custom_request using raw
HTTP request. I haven't done it but sounds challenging & fun. You can
use Webscarab to get the raw HTTP request. Basically, the body of the
request will have the contents of the file and will be something like:

-----------------------------25723100747689
Content-Disposition: form-data; name="File"; filename="readme.txt"
Content-Type: text/plain

test
-----------------------------25723100747689--

where "test" is the actual content of the file. Now you can
parameterize it however you want (atleast for ascii files). More info
on HTTP file uploads here: http://www.ietf.org/rfc/rfc1867.txt

Hope it helps,
Gaurav


--- In Advanced-LoadRunner@yahoogroups.com, <msm@...> wrote:
>
> I am unclear on what happens under the covers when a file is uploaded to
> a web site. From the Generation Log file, it appears that LoadRunner
> reads the file(s) at run time, packages them together, and sends them to
> the server as an attachment to a single POST request. Is that right?
>
>
>
> My issue is that I need to parameterize some values in the files that
> get uploaded. Any idea of how to do that? I could create a large
> number of unique files then parameterize the file name in the
> web_submit_data, but that is a pain.
>
>
>
> Better still, would be if there is a way simply generate a string in
> memory them pass it to the POST so that it looks like it is attached as
> a multipart/form-data.
>
>
>
> This is my captured/modified web_submit_data statement.
>
>
>
> web_submit_data("File Uploader",
>
> "Action=http://xyz.com",
>
> "Method=POST",
>
> "EncType=multipart/form-data",
>
> "RecContentType=text/html",
>
> "Mode=HTML",
>
> ITEMDATA,
>
> "Name=file0", "Value=C:\\temp\\CustomerOrder.dat", "File=Yes",
> ENDITEM,
>
> "Name=file1", "Value=", "File=Yes", ENDITEM,
>
> "Name=file2", "Value=", "File=Yes", ENDITEM,
>
> "Name=file3", "Value=", "File=Yes", ENDITEM,
>
> LAST);
>
>
>
>
>
> [Non-text portions of this message have been removed]
>





Thu Aug 7, 2008 5:24 pm

guitarist_in
Offline Offline
Send Email Send Email

Forward
Message #1079 of 1092 |
Expand Messages Author Sort by Date

I am unclear on what happens under the covers when a file is uploaded to a web site. From the Generation Log file, it appears that LoadRunner reads the file(s)...
msm@...
msm_portata
Offline Send Email
Aug 5, 2008
7:51 pm

... One way would be to use C file handling functions to open and modify the file with the parameters before uploading it. But depending on how much you need...
Gaurav Gupta
guitarist_in
Offline Send Email
Aug 7, 2008
10:04 pm

Hi Gaurav,   Thank you for your good suggestions.   I hate to admit it, but I got it working in JMeter then used Vugen to record a JMeter execution...
msm@...
msm_portata
Offline Send Email
Aug 7, 2008
10:47 pm

Interesting. I'll have to try that too. By correct attribute settings, do you mean the file contents in the body of the request? If possible, can you post a...
Gaurav Gupta
guitarist_in
Offline Send Email
Aug 8, 2008
6:27 pm

This is the code web_custom_request("newOrder", "URL=http://xyz.com/.../", "Method=POST", "Resource=0", "RecContentType=application/xml", "Referer=", ...
msm@...
msm_portata
Offline Send Email
Aug 8, 2008
6:31 pm

In the unlikely case that anybody's still interested, I was able to create a custom web_custom_request for file uploads. I wrote about it here: ...
Gaurav Gupta
guitarist_in
Offline Send Email
Oct 9, 2008
2:40 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help