Getting Started with Load Testing in Visual Studio 2012

Since the release of the Visual Studio 11 Beta I have had several questions about load testing in Visual Studio.  All of the questions to date have been around getting started…

Unlike Visual Studio 2010 that had Test > New Test > Load Test on the menu you have to create a new project of one of the three Test projects. 




While there is a project type called “Web Performance and Load Test Project” it doesn’t create a Load Test by default. …Which is okay as a load test without any tests to supply load to doesn’t make a lot of sense.


Fortunately adding and creating a load test is trivial….


There is also some confusion about running the Load Test as the new Test Explorer doesn’t show Web or Load Tests and the Green “Run” button for the solution is trying to run the output that being created from the solution…Which in this case is  something like: WebAndLoadTestProject1.dll.

I did speak with Peter Provost (The owner of the of the Test Explorer) and it makes total sense to me why Web and Load tests do not show up by default in the Test Explorer as his primary scenario is enabling developers do “Red, Green, Refactor” sort of workflows.  He also realizes having CodedUI Tests showing up is a little off script -and rest assured he wants to be to able service different workflows too.


We aren’t quite done yet though; as running the Load Test at this point generates the error:

Could not connect to toad lest results database.
1 If SQL Sever is not installed on the local machine you can download and
install SQL Server Express from here
2. Check that the Load Test results database specified by the connection string is
currently available and valid.



Fortunately this is quite easy to fix….Navigate to the IDE directory were you installed Visual Studio 2012 and open the file: loadtestresultsrepository.sql.

Right clicking anywhere in this file and choosing “Execute” will prompt you for the location of the SQL Server you want to store the results.

NOTE if you are installing the database using SQL Integrated Security you will want to run Visual Studio as an Administrator.




At this point your load Tests should be ready to run.

(in this case since I am just running against the performance counters for System under Test should be empty).



For more information on running and configuring Load Tests with Visual Studio 2012 please see:

Testing Application Performance and Stress