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.
I also added the file to the project and set it to be content.
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
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.
Related
I have a console application that I've been developing and I'm just about ready to publish it for consumption.
However, there's a file that the app needs to reference (a couple files actually) and I'd like to try to include these either during install logic or via an outside process. Here's the situation:
The application fires off a load test based on some criteria the user chooses. The load test is defined by a .loadtest file which is created outside of this project.
So what I would like for the installer to do is contain the .loadtest files and just shove them in a default directory that the project can reference.
I can't figure out how to add this specific file as a pre-requisite or anything though, in the publish wizard. Any ideas?
When you add a file to the solution, it does not automatically get attached as part of the build in some cases. If you right click the file in your solution explorer and select "Properties", change the build action to "Content". This will ensure that VS includes the file as part of the build/publish and places it in the output directory of the build process.
I have a set of text files that I need to have a test take in and use the items for specific parts of some Unit tests I am writing. I have put a file path in my app.config of just: .\DataLists\
After I put that in there I added the items needed to add a custom section so it would then get that file path information. The problem I am having is this...it is not finding those lists in that location it is looking at some tmp folder instead. How do I specify a proper file location for this?
Have you tried using the DeploymentItemAttribute? link Use this on the test method(s) where you need access to your 'set' (folder I assume) of text files. The best practice here is to add the folder and files you want deployed to your project file and set them to 'Copy if newer' or 'Copy Always'.
You can also add the file(s) or folder to the Deployment section of the .testsettings configuration screen. In my experience this works better during Team Builds than the DeploymentItemAttribute route. In either case the 'Enable deployment' check box found in the .testsettings config screen must be checked.
(Edit for search-ability: called "File Nesting")
I'm not sure if "folding" is the correct term, but the feature I'm referring to is shown in the 1st image below, versus the 2nd one which does not have an expandable tree list node for the code behind file.
Folding:
No folding:
My questions are:
What is the correct name of this feature?
How do I set it?
Why does my Solution Explorer not have this feature enabled when I try to convert my Web Site Project to a Web Application Project?
References:
Upgrading VS 2005 Web Site Projects to be VS 2005 Web Application
Edit
Thanks Sean, but as you can see below, my Nest Related Files button does show up in this project for some reason:
Should have button shown below:
Edit:
I figured out the reason: I accidentally created a C# Web Application Project, and then added VB ASP.NET files to it.
It's called File Nesting.
When a website project is selected in Solution Explorer, the third button in the Solution Explorer toolbar is for "Nest Related Files".
A website project or project file must be selected in Solution Explorer (rather than the root Solution), for the button to appear in the toolbar. The command/tool button is not available when C++/C# projects are selected in Solution Explorer. I don't have a web app project to test but can only conclude that the command is not applicable to web app projects either.
see this related question for a possible registry hack (changing 9.0 to 8.0 in the question's reg script):
Visual Studio 2010 related file nesting
When you are not using a website project, the nesting button in the solution explorer won't appear—but you can still nest files in .NET 5.0 projects.
Here's how you do it:
Open the project's .csproj file. Visual studio can open it in its own viewer, or else you can use your favorite XML or text editor.
Locate or create an appropriate Item Group element. If there's already one that includes some of your files, put it in there for cleanliness and consistency. If there isn't, create a new one.
Create a new Content element for the file you wish to nest. This element's Include attribute should be the name of your desired file.
Add a new DependentUpon child element to your content element. This element's text value should be the name of the file you wish to nest your target file underneath.
Save the project file and Visual Studio will likely prompt you to reload the project. If you did it correctly, your target file should now be nested under your desired file.
There's shockingly few questions and answers that address this situation. The above answer didn't help me, so I figured that I would share what did for posterity.
I'm working on an XNA project and modify a graphical asset outside of Visual Studio. In order for those changes to show up in the application, I need to remove the reference to the original image, and then re-add the same image to see the changes. This happens whether I do a complete rebuild or not. Is there a way to streamline this process so that my project shows the changes I've made without having to remove the content reference and then re-adding it after each change.
XNA is pretty smart, and only wants to re-run assets through the content pipeline when it detects something has changed. For some reason it isn't seeing the changes you are making.
Make sure you are modifying the correct file. For example if your original image is at c:\myImage.png and your project is as c:\myGame when you add the image to the Content Project it gets copied to c:\myGame\myGameContent. Editing the image at c:\myImage.png wont get noticed. You need to edit c:\myGame\myGameContent\myImage.png
If you are editing the correct file and it still won't update, try touching another file. As smart as the engine is, it will run everything through the Content Pipeline when it detects 1 item has changed.* If that still doesn't work If you look at the top of the Solution Explorer there is a refresh button. Try pressing it as it should make sure your Solution Tree is in sync with the files on disk.
*note this is true for v3.1 it could have changed for 4.0
When you drag an item into a Visual Studio project (like, in this case, a Content Project), it will copy the file into the project directory. By default it does not reference the file you drag in (although that is available as an option).
(If the file you drag in is already in the project directory, it just leaves it there.)
The upshot of this is that you need to work on your content files in the content project directory, if you want to see your updates happen immediately.
If you don't know where the files are being copied to, select one of them in your content project and press F4 (properties window). Find the "Full Path" entry. That is where your files are stored.
I am creating a clickonce installer using the deployment strategy of Install from the Web or network share, on one of my project. I am learning how to use click once installers. When i publish my project it gets succeeded. i gave the URL of my website that i had created through google so that anyone can install from that URL. After publish gets succeeded the URL should be launched automatically but it is not. Moreover. When i check my website and in it that page whose URL i had given, there is nothing there. No installer. Please help.
Right Click on Publishing Project
Click Properties
Click "Publish"
In "Publishing Folder Location" is anything set there?
Click the button with ellipsis (...) to the right of the combobox
Click "FTP Site" (not Remote site, as this needs FrontPage extensions)
Enter the Server information, Directory (that you have access to), keep it as passive mode, uncheck the Anonymous option and put in the valid FTP instructions.
Click Open, and Republish. All should work 100% with this.
If not, have a look in your wwwroot/ folder and find the application information (if it's there) and you will have to manually upload the files.
EDIT for comment:
The website that you are uploading to, does it have FTP access? Meaning a place that you would upload file to for display on the website, even like your html content? (index.html etc.)
If not, you will need to get these details from your website hosting provider and fill in the appropriate fields for the FTP upload.
It's a while since I did this, but I'm fairly sure that you have to upload the files manually.
The installer needs the location so it can build the web page etc. All the files should be in an output folder in your project.
EDIT: I've just checked and the output folder is the one you specify on the first step of the Publish Wizard. If you specify a local folder the files will be put there for you to FTP to your website later. You can also specify a remote address as and FTP or HTTP location (which I'd forgotten when I posted my original answer). You'll have to enter the user name and password for connecting to the remote location later in the process.
Are you using Visual Studio 2008? The default behaviour of deploying a "publish.htm" page has changed.
Bring up your project's properties and switch to the "Publish" tab. Click the "Options" button and switch to the "Deployment" section of the dialog. You'll see by default that the "Deployment web page" TextBox is empty. You'll need to give that a value and also check the "Automatically generate deployment web page after every publish" CheckBox.
I've taken to filling that in with "default.htm" so that whichever folder you deploy your app into will have the ClickOnce publish page as its default page.