473,387 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Webtest upload file

MD
Hello, I am using VS 2005 for Software Testers - I am having trouble
testing the upload of a file (simple text file) to the server. My .NET
code is as follows :-

ASPX:
<input id="filefield1" type="file" name="filefield1" runat="server">
<input type=submit runat=server id=DoUpload value="Upload"
NAME="DoUpload"/>

ASPX.CS:
Protected WithEvents DoUpload As
System.Web.UI.HtmlControls.HtmlInputButton
....
Private Sub DoUpload_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DoUpload.ServerClick

And my webtest is as follows:-

WebTestRequest request12 = new
WebTestRequest("http://vap2.test.group.local/CU1.aspx");
request12.Method = "POST";
request12.QueryStringParameters.Add("class_id", "4", false,
false);
request12.QueryStringParameters.Add("obj_id", "227", false,
false);
FormPostHttpBody request12Body = new FormPostHttpBody();
request12Body.FormPostParameters.Add("__EVENTTARGE T",
this.Context["$HIDDEN1.__EVENTTARGET"].ToString());
request12Body.FormPostParameters.Add("__EVENTARGUM ENT",
this.Context["$HIDDEN1.__EVENTARGUMENT"].ToString());
request12Body.FormPostParameters.Add("__VIEWSTATE" ,
this.Context["$HIDDEN1.__VIEWSTATE"].ToString());
request12Body.FormPostParameters.Add("txtDocumentT itle",
"testing2");
request12Body.FormPostParameters.Add(new
FileUploadParameter("filefield1", "c:\\dontneed\\test2.txt"));
request12Body.FormPostParameters.Add("DoUpload", "Upload");
request12Body.FormPostParameters.Add("cmdDone", "Done");
request12.Body = request12Body;
yield return request12;

When I record the webtest all is fine, however when I rerun the
webtest, the resulting page shows "Object moved to here" and a HTTP
status code of 302 (redirected to found page) occurs.

It may have something to do with the button click not being captured as
webtests do not track Javascript. I have tried using Fiddle but to no
avail.

Please can anyone help - I can't find any examples of testing an upload
process via VS2005.

Many thanks
Travis

Jun 14 '06 #1
1 3076
MD
I forgot to mention here, the problem is not the 302 - it's the fact
that the file does *not* successfully upload when I play the script
back - has it got to do with the way VS2005 for Software Testers
interpretation of the submit button click's wiring to the ServerClick
event ? Or is there something I have missed - has anyone else out
there successfully tested (via a VS2005 webtest) a file upload ?
Cheers
Travis
MD wrote:
Hello, I am using VS 2005 for Software Testers - I am having trouble
testing the upload of a file (simple text file) to the server. My .NET
code is as follows :-

ASPX:
<input id="filefield1" type="file" name="filefield1" runat="server">
<input type=submit runat=server id=DoUpload value="Upload"
NAME="DoUpload"/>

ASPX.CS:
Protected WithEvents DoUpload As
System.Web.UI.HtmlControls.HtmlInputButton
...
Private Sub DoUpload_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DoUpload.ServerClick

And my webtest is as follows:-

WebTestRequest request12 = new
WebTestRequest("http://vap2.test.group.local/CU1.aspx");
request12.Method = "POST";
request12.QueryStringParameters.Add("class_id", "4", false,
false);
request12.QueryStringParameters.Add("obj_id", "227", false,
false);
FormPostHttpBody request12Body = new FormPostHttpBody();
request12Body.FormPostParameters.Add("__EVENTTARGE T",
this.Context["$HIDDEN1.__EVENTTARGET"].ToString());
request12Body.FormPostParameters.Add("__EVENTARGUM ENT",
this.Context["$HIDDEN1.__EVENTARGUMENT"].ToString());
request12Body.FormPostParameters.Add("__VIEWSTATE" ,
this.Context["$HIDDEN1.__VIEWSTATE"].ToString());
request12Body.FormPostParameters.Add("txtDocumentT itle",
"testing2");
request12Body.FormPostParameters.Add(new
FileUploadParameter("filefield1", "c:\\dontneed\\test2.txt"));
request12Body.FormPostParameters.Add("DoUpload", "Upload");
request12Body.FormPostParameters.Add("cmdDone", "Done");
request12.Body = request12Body;
yield return request12;

When I record the webtest all is fine, however when I rerun the
webtest, the resulting page shows "Object moved to here" and a HTTP
status code of 302 (redirected to found page) occurs.

It may have something to do with the button click not being captured as
webtests do not track Javascript. I have tried using Fiddle but to no
avail.

Please can anyone help - I can't find any examples of testing an upload
process via VS2005.

Many thanks
Travis


Jun 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
0
by: Derek | last post by:
what usually causes a java.security.NoSuchAlgorithmException? i am getting this while trying to run WebTest with SSL. so, if there is anyone out there using SSL and webtest i would appreciate...
0
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
0
by: ddoc | last post by:
Hi, I record a webtest. When I lauched by testManager this webtest, the result is a success. I launch one more time and the result is the same. I create a loadtest and I add this webtest....
2
by: hurstbp | last post by:
Hello, I'm writing test scripts in Canoo's WebTest. Basically, I need to run through a table of data and find an ID number for a specific case, then follow the link for that case's details page,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.