Team System Developer Center >
Visual Studio Team System Forums
>
Visual Studio Team System - Testing
>
WebTest VS TE 2008 - file upload problem
WebTest VS TE 2008 - file upload problem
- Hi,I've got a question. I've recorded a webtest, exported it to C# code, and re-run it.
During one scenario file upload should be done, test ends with "Passed" result, but file is not uploaded.Could you take a look at this code fragment and help me out ??
FormPostHttpBody request23Body = new FormPostHttpBody();request23Body.FormPostParameters.Add("__EVENTTARGET", this.Context["$HIDDEN1.__EVENTTARGET"].ToString());request23Body.FormPostParameters.Add("__EVENTARGUMENT", this.Context["$HIDDEN1.__EVENTARGUMENT"].ToString());request23Body.FormPostParameters.Add("__LASTFOCUS", this.Context["$HIDDEN1.__LASTFOCUS"].ToString());request23Body.FormPostParameters.Add("__VIEWSTATE", this.Context["$HIDDEN1.__VIEWSTATE"].ToString());request23Body.FormPostParameters.Add("IconBar.ascx$optMode", "VIEW");request23Body.FormPostParameters.Add("IconBar.ascx$optModuleType", "0");request23Body.FormPostParameters.Add("IconBar.ascx$cboDesktopModules", "-1");request23Body.FormPostParameters.Add("IconBar.ascx$cboPanes", "ContentPane");request23Body.FormPostParameters.Add("IconBar.ascx$txtTitle", "");request23Body.FormPostParameters.Add("IconBar.ascx$cboPosition", "-1");request23Body.FormPostParameters.Add("IconBar.ascx$cboPermission", "0");request23Body.FormPostParameters.Add("IconBar.ascx$cboAlign", "left");request23Body.FormPostParameters.Add("dnn$dnnSEARCH$txtSearch", "");request23Body.FormPostParameters.Add("dnn$ctr412$Edit$UploadFromCsv1$incentiveControl$ddlIncentive", "21");request23Body.FormPostParameters.Add("dnn$ctr412$Edit$UploadFromCsv1$incentivePeriodControl$cbShowOpenOnly", "on");request23Body.FormPostParameters.Add("dnn$ctr412$Edit$UploadFromCsv1$incentivePeriodControl$ddlIncentivePeriod", "166");request23Body.FormPostParameters.Add(new FileUploadParameter("dnn$ctr412$Edit$UploadFromCsv1$spreadsheetControl$fuplExcel", "C:\\Documents and Settings\\My Documents\\Company Check.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));request23Body.FormPostParameters.Add("dnn$ctr412$Edit$UploadFromCsv1$spreadsheetControl$txtComments", "Automation;");request23Body.FormPostParameters.Add("dnn$ctr412$Edit$UploadFromCsv1$spreadsheetControl$btnUpload", "");request23Body.FormPostParameters.Add("dnn$ctr412$Edit$UploadFromCsv1$spreadsheetControl$btnUpload", this.Context["$HIDDEN1.__OboutIncFileUploadKey__dnn_ctr412_Edit_UploadFromCsv1_spreadsheetContr" +"ol_fileUploadProgress"].ToString());request23Body.FormPostParameters.Add("ScrollTop", "54");request23Body.FormPostParameters.Add("__dnnVariable", this.Context["$HIDDEN1.__dnnVariable"].ToString());request23.Body = request23Body;
Cheers, and thanks in advance !- Changed TypeEdwer FangMSFT, ModeratorWednesday, November 11, 2009 9:47 AM
All Replies
- Hello disu,
Could you please verify if the web site itself could upload the file correctly? If yes, could you please delete the uploaded file in the server side if there exists and re-run the web test to see if the file has been uploaded or not? Does it work with UI web test?
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com. - We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.


