Learn to use Visual Studio, Visual Studio Online, Application Insights and Team
Foundation Server to decrease rework, increase transparency into your application and increase the rate at which
you can ship high quality software throughout the application lifecycle
At StarEast I had a couple of Web Performance Tests in my demo solution that people asked about. Namely the Web Tests called:
As the name suggests with the first Web Test is something I have been working with Perfecto Mobile on some of their new features and hope to have another post when they are ready to make an announcement – Sorry guys no spoilers just yet!
The second Web Test is as the name suggests data bound to a search term list (in our session we looked at how our Search Engine Optimization was trending).
While data binding a Web Test is not hard –it is also not intuitive and taking it to a Cloud Test has some caveats I thought I would walk through.
Step 1. Creating a Web Performance and Load Test
This is as easy as File>New Project>Web Performance Test in Visual Studio Ultimate. (Yes this is ONLY available in Visual Studio Ultimate – but we make this freely available as a trial here: http://www.visualstudio.com )
Step 2. Create a Web Test Recording
In this example ALL I did was open Bing and searched for the term “Phone Frogger”
Step 3. Clean up the Web Test Recording
As I indicated above i ended up with all this traffic by recording the action of typing in a search term and hitting the search button!…As you can see Bing is certainly pretty chatty under the covers to give you those search suggestions.
Luckily the only call I actually need is the post to /Search. While I could run the Web Test like this those other calls will skew the results so lets delete everything but the call to the search page!
Step 4: Add a data source
In the Web Performance Test editor there is an icon for adding a data source –and while it lists three sources: Database, XML or CSV since this is to be a Cloud Load Test we are limited to either XML or CSV files that can be copied to the Load Test Virtual Machine. In this case I am selecting a CSV file with a single column called “Search”. If you look at the properties of the data source from within the web test you will get options as to how to traverse the data source: Do Not Move, Random, Sequential or Unique…Unfortunately these settings are ignored in a Cloud Load Test so I am not going to bother changing from the default(sequential).
Expanding the search post of my Web Performance Test you will see the parameters used in that post…one of which was the term I typed in: “PQ=Phone Frog”.
Selecting the properties (keyboard shortcut “F4”) you will see the properties to data bind the search value to the data source created above.
Step 6: Run the Web Test
Unfortunately running the web test now not only does it fail…it only fails with the first record in your data source…Grrr!
Step 8: Finish the clean up of the Search post
Almost invariably when cleaning up a Web Performance Test it leaves artifacts in the post you care about…and this will also need to be cleaned.
In this case the search post referenced a a hidden form that we need to remove
Step 7: Set Web Performance Test Run Count
The default for a Web Performance Test is to ONLY run a fixed run count of ONE. To get our Web Performance Test to run through all the rows in our data source you need to open the file called Local.Testsetting files stored at the Solution level of your Web Performance Test Project and change the Web Test setting to One run per data source. You will see in the image below behind the dialog a test run where I walked through all the rows in my data source –and the last failed. (It failed as the term had an illegal character not allowed by Bing).
Step 8: Creating a Load Test
While there is a lot of information that can be supplied to customize your Load test the Wizard does a great job of walking you through it. To get started simply right click on the Web Performance Load Project and choose a new item of type Load Test.
The wizard will automatically start – and the only setting you MUST fill in is the step requesting which tests do you want to run.
Step 9: Run this as a Cloud Load Test
While this step probably has the greatest ramifications in terms of logistics – it is also one of the easiest steps! Once again opening the file called Local.Testsetting files stored at the Solution level of your Web Performance Test Project and change the General setting to “Run Test using Visual Studio Online”. By setting this we will create a Virtual machine in an Azure data center, copy your Web Performance Tests, data sources and other needed setup files and run your Load Test from this virtual Machine.
One thing you will notice when make this change is all your other settings – such as the settings for your Web Performance Tests disappear. The reason for this is the Web Test Settings aren’t used from within a load test– such as how you run through your data source this MUST be set in the Web Test itself.
For more information on creating a load Test: http://blogs.msdn.com/b/visualstudioalm/archive/2014/04/07/get-application-performance-data-during-load-runs-with-visual-studio-online.aspx