Showing results for 
Search instead for 
Do you mean 

File Upload issue

Advisor

File Upload issue

[ Edited ]

Hi,

I'm working on LR11- HTTP protocol on .NET applicaiton.  can anyone tell me how do i handle Upload file on web page.

 

below is the code which is being generated while uploading doc.

web_submit_data("FileUpload",
"Action={URL}",
"Method=POST",
"EncType=multipart/form-data",
"TargetFrame=",
"RecContentType=text/html",
"Mode=HTML",
ITEMDATA,
"Name=ctl00$Body$UploadControl$DocSubCat", "Value=71", ENDITEM,
"Name=ctl00$Body$UploadControl$DocumentType", "Value=329", ENDITEM,
"Name=File", "Value=<path>", "File=yes", ENDITEM,
"Name=ctl00$Body$UploadControl$Submit", "Value=Upload Document", ENDITEM,
"Name=ctl00$Body$UnUsualMultitxt", "Value=", ENDITEM,
"Name=ctl00$Body$alleged", "Value=", ENDITEM,
LAST);

 

Below is the code being generated while clicking on Submit on same page.

web_submit_data("BB687.aspx_5",
        "Action={URL}",
        "Method=POST",
        "EncType=multipart/form-data",
        "RecContentType=text/html",
        "Referer={URL}",
        "Snapshot=t90.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=__EVENTTARGET", "Value=", ENDITEM,
        "Name=__EVENTARGUMENT", "Value=", ENDITEM,
        "Name=__LASTFOCUS", "Value=", ENDITEM,
        "Name=__VIEWSTATE", "Value={Siebel_Analytic_ViewState9}", ENDITEM,
        "Name=__VIEWSTATEENCRYPTED", "Value=", ENDITEM,
        "Name=__EVENTVALIDATION", "Value={eventvalidation_9}", ENDITEM,
        "Name=ctl00$Body$UploadControl$DocSubCat", "Value=71", ENDITEM,
        "Name=ctl00$Body$UploadControl$DocumentType", "Value=-1", ENDITEM,
        "Name=ctl00$Body$UploadControl$Upload$FileUpload", "Value=", "File=yes", ENDITEM,
        "Name=ctl00$Body$UploadControl$DocumentDescription", "Value=", ENDITEM,
        "Name=ctl00$Body$UnUsualMultitxt", "Value=", ENDITEM,
        "Name=ctl00$Body$alleged", "Value=", ENDITEM,
        "Name=ctl00$Body$Matterchk", "Value=on", ENDITEM,
        "Name=ctl00$Body$Preview", "Value=Preview", ENDITEM,
        LAST);

20 REPLIES
Advisor

Re: File Upload issue

I have already done correlation but its not helping

Frequent Advisor

Re: File Upload issue

Hi,

and what is your problem?

Best Regards, Jürgen

Regular Advisor

Re: File Upload issue

[ Edited ]

Yeah you didn't actually say what the problem was but I'm going to assume you're wondering how to execute your script on the controller when you have a local path hardcoded in the script: "Value=C:\\Users\\c-jshah\\Desktop\\New Text Document.txt"?

 

The answer is to add the file to your script folder (in Vugen the function is called 'Add Files to Script') and then you can reference it by using just the filename:  "Value=New Text Document.txt" and because it's not an absolute path it will by default look inside the script folder. 

 

You seem new so you should get a mentor for these types of questions. Everyone new at LoadRunner should have someone experienced mentoring them. Otherwise you're being setup to fail at your job.

Advisor

Re: File Upload issue

oh ...

 

let me give you some idea here.. after doing the co-relation when i replay the script its failing at that point. so just to make sure i put the output msg to see upto what point its getting executed.

 

flow:

upload file1

upload file2  <-- upto this point its getting executed but then after it fails

submit button....

 

in earlier post you can see the code being generated while uploading doc and 2nd  code is generated when i click on Submit

Advisor

Re: File Upload issue

no i have not even reach there.. m still on LoadRunner.. i'm not able to execute the script successfully... please read my other post which might help you to ans.

Thanks,
Regular Advisor

Re: File Upload issue

You're still in VUgen and not yet in the controller? Ok. But just so you know, once you get to the controller you will have problems because this local pathway (C:\\Users\\c-jshah\\Desktop\\New Text Document.tx) will no longer be valid, so you will have to use the 'Add files to script' functionality to solve that issue.

 

Regarding your replay issue, it's possible that you haven't done all the proper correlations. Overall the best way I've found to find correlations is to record the script twice and then compare the scripts using a diff program to see the differences. And then typically anything different will have to be correlated.

 

Are you new to LoadRunner and performance testing?  If so, the real solution to most problems is to make sure that you've had proper training and that you have a mentor for your first few projects. Have you gone through proper training and do you have a mentor?

Advisor

Re: File Upload issue

Thanks you so much for you advice.. even i think that i should compare script.. may be due to correlation i'm failing..

 

que.1)

do you think File Upload will be capture as a part of HTTP protocol?  

 

There is one more issue .. everytime URL has been redirected... so I might be missing that. Can you guide me how to handle that. I went thru some Forum it says Set the property as IgnoreRedirection=NO and correlate the Redirected URL..

 

que 2)

is that right?

Valued Contributor

Re: File Upload issue

que 1)

 

In upload activity, HTTP protocol will capture only the path of that file. As Loadrunner421 said, you add that files to your script to handle the upload file activity.

 

que 2)

 

If "IgnoreRedirections=Yes" is specified and the server response is redirection information (HTTP status code 300-303, 307), the response is not searched. Instead, after receiving a redirection response, the GET request is sent to the redirected location and the search is performed on the response from that location.


This attribute is optional. The default is "IgnoreRedirections=No".

 

Hope this information would help you.

Highlighted
Frequent Advisor

Re: File Upload issue

and where you see that it is failing? You get an error message????

Advisor

Re: File Upload issue

Yes Pathan its helpful...
currently i'm struggling with Redirection issue.. let me explain you here..
Advisor

Re: File Upload issue

can you tell me how do i handle redirection. everytime i web_submit_data.. it says its redirected and script fails.. i correlate the value generated after
.aspx?weoiruewpordj;asldjf
based upon LB and RB in Generation log but it fails..
Advisor

Re: File Upload issue

the error is something like

Redirecting "{URL}.aspx?" (redirection depth is 0)      [MsgId: MMSG-26694]

 

To location "{URL}.aspx?KV3ysYrJCFZRgeOOsiFezIwAwuxVh_8lWnvsmyoS7QmU@zCB9Shfkquro2iqdrAT7Of43HMBmYm5w0exLMhSrT8fa6_thAP1l1VgfpEDhmg-@bAGd8Q7jGhk1_T9vjm5m8xcu2L3qKHEiP_@20plq5ECzvhLcGbG5"      [MsgId: MMSG-26693]

 

Valued Contributor

Re: File Upload issue

Can you please post the exact error description which you get while replying the script to better understand? By seeing your replies i understood that the value need to be properly correlated. if possible, plz paste your web_submit_data function where you got this error

Advisor

Re: File Upload issue

[ Edited ]

Pathan its being solved... thanks for the help :)

 

 

now another issue i'm facing is Multiple calls has been made from the same page with same LB and RB and its not getting resolved.

Valued Contributor

Re: File Upload issue

Even though If it is with the same lB and RB, the value might be in different ordinals (positions). You can use "ORD=xx" Argument in web_reg_save_param() to resolve your issue.

 

Advisor

Re: File Upload issue

Pathan its passing for the first time without any issue..and  i've not mentioned any ORD as of now...

The Query string which is being generated is unique all the time so i can mention ORD=1 in all the calls right?

Regular Advisor

Re: File Upload issue

Jinesh,

 

Not to sound like a broken record but you didn't answer me before so...do you have someone at your work with senior LoadRunner knowledge available for these basic questions? What did they say when you asked them this?

 

 

I bring this up because it sounds like you weren't setup properly when you started this job.

When you start as a performance tester you need these two things:

 

1) Formal Training

2) Someone to mentor you for your first few projects (Because as you can see, there is lots of questions!)



So, did your work provide you with those two things? If everyone was setup properly at the beginning then the performance testing industry would be in a lot better shape. 

 

Advisor

Re: File Upload issue

here i dont have any Sr. person who knows load runner... if i get into issue i've to find myself only... :(
Regular Advisor

Re: File Upload issue

I see. Well did they at least pay for formal training?

 

A good analogy I've seen used is that if you hired a plumber for your house you would want someone trained. And if they are new you would want their mentor there with them. If you're untrained and have no mentor then it's very similar to having an untrained unmentored plumber working on your house. Meaning they can't be trusted to fulfill the obligations of their job.

 

Anyway I'm sorry your work has put you in this awkward situation. The same thing happened to me at my work and now I know that if I'm placed on a task I will make sure I am properly trained and have the proper guidance otherwise I let everyone know that they can expect a crappy job. This is why I tell others to make sure they aren't being setup to fail like I was. 

Advisor

Re: File Upload issue

//FILE OPEN CODE
long fp;
char *data;
unsigned long prmLen;
web_set_max_html_param_len("200000");

//correlation

web_reg_save_param("rate",
"LB=Watch here ",
"RB= information",
"IgnoreRedirections=Yes",
"Search=Body",
LAST);

//file save

fp = fopen("D:\\rate.txt","wb");


lr_eval_string_ext("{rate}", strlen("{rate}"), &data, &prmLen, 0, 0, -1);

fwrite(data, prmLen, 1, fp);

fclose(fp);

lr_output_message("ans-> %s",lr_eval_string("{rate}"));