Web performance/load testing can sound like an intimidating thing, but it is not. And web performance/load testing SharePoint has been made a lot easier with Visual Studio 2012 Update 1. So here is a quick introduction into the subject.
- Visual Studio 2012 Ultimate Edition (preferably with Update 1 as it provides the new features for testing SharePoint).
- A SharePoint OOB installation
- A SQL Server instance (any edition) to create the LoadTestResultsRepository database required by VS 2012’s load testing features. To create the database, browse to C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE from a command prompt window and run SQLCMD /S <yoursqlinstance> -i loadtestresultsrepository.sql
1. Launch Visual Studio 2012 Ultimate > New Project > Test > Web Performance and Load Test Project
When the web performance test is created successfully, an IE window will load with the Web Test Recorder plugin loaded and recording is started. Browse the SharePoint site as the scenario dictates and the Web Test Recorder will record each and every web request (URL) you visit (explicitly or implicitly).
* if you receive any error messages when loading the Web Test Recorder Plugin, Enable 3rd party extensions in IE advanced options
3. When done, click Stop in the Web Test Recorder plugin. Visual Studio will save the Web performance test and replay it for one time.
4. If a ProcessQuery request fails, it is because it is expecting a header (X-RequestDigest). So how do we pass this header to the request? Right click the first request in the web performance tree, Add an extraction rule to extract the form input __REQUESTDIGEST and save it in a context parameter (name it for example digest). Right click the ProcessQuery request and click add header. The header name should be X-RequestDigest and the value should be bound to the parameter context digest we created in the extraction rule.
5. Try to replay the test and it should work out successfully.
For more information on Web performance/load testing SharePoint, see the following.
- Web Performance and Load Testing SharePoint 2010 and 2013 Applications http://msdn.microsoft.com/en-us/library/vstudio/jj710162.aspx
- SharePoint load testing made easier with Visual Studio 2010 Update http://blogs.msdn.com/b/visualstudioalm/archive/2013/02/01/sharepoint-load-testing-made-easier-with-visual-studio-2012-update.aspx
- How to: Create a Load Test Results Repository Using SQL http://msdn.microsoft.com/en-us/library/vstudio/ms182600.aspx
- Getting Stared with Load and Web Performance Test Walkthroughs http://msdn.microsoft.com/en-us/library/vstudio/ee923685.aspx