5

I have a .webtest that I am intending to use to load test uploading a file to a website. I am using the webtest framework that is built into visual studio with the intention of running my larger scale tests from azure.

I created a new webtest and recorded the steps, including the file upload. This all recorded correctly, but the problem is that the File Upload Parameter was just recorded the filename (not the bytes). This means that the test needs to have access to the file that will be uploaded during running.

Recorded upload

I also added the file to the project and set it to be content. Content file

The problem is that the file isn't getting copied over during running. I found a blog post https://blogs.msdn.microsoft.com/edglas/2008/08/05/how-to-upload-a-file-in-a-web-test/ which appears to answer my question but the visual studio ui has changed and the option is no longer available.

I cannot use an absolute url c:\files\filename.docx because i need to run this from azure.

I also cannot post the file somewhere on the internet because it has to be a path, not a url.

I have posted a queston to the blog post, but it doesn't seem very active and am really at a lose for where to go from here.

TIA, -Logan

Logan
  • 195
  • 8

1 Answers1

4

The "Deployment" functionality shown in the last screenshot of Ed Glass's blog is now in the .testsettings files of the solution. (The blog shows a window with a "localtestrun.testrunconfig" file.) If you have more than one .testsettings file then ensure that the context menu of the correct file has the "Active load and web test settings" ticked.

In the deployment section of the .testsettings file, tick "Enable deployment" and add the directory or file(s) to be used in the tests. After running a test you should then find that the items have been copied into a subdirectory of the TestResults\{{name+date+time}} directory, as described in the blog.

New .testsettings files can be added to a solution as follows. From the context menu of the solution (the topmost item in Solution Explorer), select Add => New item => Test settings (from the left hand side of the "Add new item" window), then fill in the forms. New files can also be created via the "Save as" button in the test settings editor, but this requires a file to already be open.

When creating new .testsettings files I recommend changing the "Name" field in the "General" section to match the filename. Not doing so (after using "Save as") has left me confused because two or more files appear to have the same name. I normally have up to three .testsettings file in a solution: One for local use when developing tests. Another (often named "cloud" or "vsts") configured for cloud load testing with VSTS. The third version (often named "agent" or "remote") for use with controllers and agents.

AdrianHHH
  • 13,492
  • 16
  • 50
  • 87
  • Ok, this comment really lead me to my solution. My problem was that i was working with a project that was created last year and didn't have a *.testsettings file and i could not find any way to add it. I ended up creating a new load test project through visual studio and it added the local.testsettings file (in the same dir as the solution). From there it was relatively easy to import my old tests and add the file as a deployment file in the Local.testsettings. – Logan Dec 06 '16 at 12:33
  • @Logan Please see the new paragraphs in the answer. – AdrianHHH Dec 06 '16 at 12:50