, , , , , , , , ,

This is very different to the coded UI tests that I covered last week, and the process isn’t quite as straightforward.

The following are required:
* Visual Studio (Ultimate)
* Visual Studio Online account or Team Foundation Server

Setting Up
A load test uses a ‘Team Foundation Server’ (TFS), which is either an individual installation or obtained by registering a Visual Studio Online account at https://visualstudio.com.
When that’s sorted, sign into the TFS by clicking the icon at the top-right of the Visual Studio environment.


The project details will appear in Team Explorer window, where the Solution Explorer normally is.


Creating a Web Performance Testing Session
A Web Performance Test Project must be set up before any load testing is done. In Visual Basic or Visual C#, navigate to ‘Test’ and select ‘Web Performance and Load Test Project’. The Solution Explorer will re-appear. Add a Web Performance Test to the project.



Visual Studio should automatically begin recording the Internet Explorer session, unless an existing project is selected and the Add Recording button is clicked. The Microsoft Web Test Recorder browser add-on must be enabled at this point.


When finished, click the Stop Recording button. The steps will be displayed in the main window, and can be replayed using the Run Test button above.
A successful run will produce output similar to the following example:


The Load Test
With a recorded Web test session, the project should be ready for a load test. This time, add a Load Test to the project. This will start the New Load Test Wizard – this is where the ‘load test scenario’ is created and the Web test scripts imported.


When the dialogue closes, a tree structure will appear in Visual Studio’s main window. With a bit of luck Visual Studio will connect to the right server, queue the test and execute it when the Run Test icon is clicked.


Analysing the Results
But how to get the metrics and flashy graphs we’re after? Simple: Just double-click the load test name to get the tree structure in the main window, then click the Open and Manage Results button at the top-left.


In the Open and Manage Load Test Results, click ‘Open…’, and the metrics will appear in Visual Studio’s main window.