Testing SharePoint 2010 with Visual Studio 2012 Update 1

Charles Sterling

Another in my MVP series of blog posts:

This post is by one of the most active of the Canadian MVPs, Wes McDonald.  I find it interesting that Wes and our neighbors up north have taken the spirit of the US code camps and turned it in to arguably Canada’s best developer conference that is both internationally recognized and commercially viable (no small feat in this economy) series called “DevTeach” – Great work guys!

-Chuck

***********************************’**********************************************************************************

Web Testing SharePoint 2010 with Visual Studio 2012 Update 1 CTP 3 by Wes MacDonald

I am certain this has been a long standing request from Visual Studio by the community, myself included.  If you’ve attempted this in the past with previous versions of Visual Studio you would have realized quickly that it wasn’t quite up to the task unless you heavily edited the recording that was produced.  It’s not that the Web Test would have failed but the fact that requests to pages named:

  • blank.htm
  • ScriptResx.ashx
  • commandui.ashx

would have remained as part of the recording.

Visual Studio 2010 Web Test Recording

Previous versions of Visual Studio also would not recognize a Site Name as a Parameter either.

To get started you’ll need to ensure you have the following installed:

Visual Studio 2012 Ultimate (Web Performance Testing is an Ultimate Feature)

Visual Studio 2012 Update 1 CTP(available here (editors note: and more information about it can be found here Final CTP for Visual Studio 2012 Update 1 )

To verify you’ve got everything and you’re ready open Visual Studio 2012 and select Tools | Options | Web Performance Test Tools | Web Test | SharePoint and you should see the following:

I’ve already had to add an additional Pattern to the out of the box settings because one of the SharePoint sites I was recording was returning a blank.html page.

To get started create a New Project | Installed | Templates | Visual C# | Test | Web Performance and Load Test Project

If you don’t see the Template make sure the .NET Framework is set to either 4.0 or 4.5 so the template displays.

New Web Performance and Load Test Project

Once the project has been created Add a Web Performance Test to it and your web test will be added and Internet Explorer will be launched ready to record your actions.

While it is recording don’t be alarmed by all of the requests listed in the Web Test Recorder window, the requests for ScriptResx.ashx, blank.htm and others will be removed once the recording is stopped.

Recording SharePoint Web Test

Let’s stop the recording and allow Visual Studio to process the web test recording

SharePoint Server 2010 Web Performance Test
One of the things you’ll notice right away is that the site names have already been extracted for you:

  • SiteName1=sp2010pillars
  • SiteName2=Projects
  • SiteName3=M300DigitalCamera

If you wanted drive the site names from a SiteNames.csv file you could easily add a data source to the web test and then perform a search and replace on {{SiteName1}} and replace it with {{Datasource1.SiteNames#csv.SiteName}}

I think you’ll find this extremely valuable for testing your SharePoint Server configurations, you can also easily configure an Extraction Rule on your individual requests to get values of SharePoint Calendar Dates and Items, List Items, Documents and others.

SharePoint - Add Extraction Rule

 

About wesmacdonald

Wes MacDonald is a Visual Studio ALM MVP, MCTS, MCITP (SharePoint 2010) and a Principal Consultant for LIKE 10 INC., a SharePoint Server and Team Foundation Server Consulting Firm providing premium support and guidance services.

0 comments

Discussion is closed.

Feedback usabilla icon