All about the Strategy, Design, Customisation, Deployment and Development of SharePoint and its related Technologies

  Administration   All Me!! Baby!!   BDC   Book Review   Business   CKS   Conferences   CQWP   Development   Duffer Moments   Email   Errors   Family   Fixes   General   Groove   How To   How To Code   InfoPath   iPhone   IRM   Longhorn   Lotus Notes   Migration   Mobility   Office System 2007   Personal Projects   Powershell   Records Management   Search Server   Security   SharePoint   SharePoint 2010   Silverlight   SQL   Tech Ed 2008   Testing   Vista   VSTO   WSS   XSL

[10/03/2008] MOSS2007 Testing Using Visual Studio Team System 2008
 
Categories: Development, Office System 2007, SharePoint, Testing
 

Probably like most of you out there who work with SharePoint, you will probably be asked about testing the performance of the solution. For quite a few projects I have worked on recently I have been asked to test the performance and have often wondered the best approach to take.The best article I found was by Bill Baer which talks about the various applications that can be used to stress test the solution.

http://blogs.technet.com/wbaer/archive/2007/08/02/stress-testing-microsoft-office-sharepoint-server-2007-windows-sharepoint-services-3-0.aspx

After some further investigation I decided that I wanted to use Visual Studio Team System 2008 to stress test my SharePoint solutions. The testing applications within Visual Studio are fantastic and you don't even need to be a developer to use this. To show how easy it is I will take you through the steps needed to test uploading a document into a SharePoint document library. To begin with you will need to have installed Visual Studio Team System 2008 and at least know what the user interface looks like. 

Once Visual Studio loads select the menu link at the top called "Test", and then select the "New Test" option.

You will then need to select the "Web Test" option and give it a name.

You will then be asked for a project name and then press okay for it to create the project.

Once the project is created, Internet Explorer should load and a recorder toolbar will load as shown below:

The recording toolbar will record every key stroke and URL that you visit so you can play it back later. In this example I am going to access a team site, then the document library and then upload a file.

Notice that as we access the sites and pages they are all stored in the recording toolbar. When you have completed the process press the "STOP" button. This will take you back to the main Visual Studio project and load the screen with the recorded URL's.

Just as a note here, there seems to be a problem here as the recording does not seem to record the form post parameters such as the file location etc that you would expect to see if you were using something such as Fiddler. I have not yet seen a fix for this but to fix it the following needs to happen.

   

You need to right click on first URL and select the "Add Extraction Rule".

Select the "HIDDEN" fields rue and simply name the context parameter name "1". This will extract any hidden field values from the running page context.

Now we need to add various form post parameters, these can be added by select the option on the right click menu.

A standard parameter is then added as shown below.

The following parameters need to be added with the values shown below:

To add a value to the parameter you can use the properties window in Visual Studio. The example below is for the upload control within SharePoint.

Now we have our test built we can simply run this (ensure that the original document is removed before testing). Once the test is completed the main Visual Studio screen should look at shown below:

This is just a basic example of using Visual Studio 2008 Team System for testing. In another post I will share the project that I have created for testing. It can be used to test things such as:

  1. Page Access
  2. My Site Access and Creation
  3. Site Creation and Deletion
  4. Upload Single and Multiple Documents
  5. Searching

If you pop over to Codeplex and access the following project SharePoint 2007 Test Data Population Tool, you can download a Visual Studio 2005 Team System project that has some of the same functionality that I am using in my own test projects, there is also an Excel Services test project.

 
12 Comments
 

Comments

Thursday, 8 May 2008 05:40 by Fernando
hi, im tried to reply your script and it failed. This is the message that send me once i do all long process. Request failed: Context parameter '$HIDDEN1.__EVENTTARGET' not found in test context I hope you can help me as soon as posible. This is my e-mail gudrockfh@hotmail.com and if you cant answer me by phone only give me your phone number and i will call you. Thanks in advance.

Wednesday, 11 Jun 2008 05:06 by Nick
Hi Liam, I too suffer from the problem that Fernando highlights above. I have been struggling to perform an upload using Visual Studio 2008 for some time - and this would help me out so much. Please can you advise what I can do to resolve this? Kind regards, Nick

Thursday, 12 Jun 2008 10:48 by Nick
Hi, Just thought that I would post an update to this - I installed SP1 for Visual Studio, and recorded the upload again; this time Visual Studio captured all the information which you added manually earlier. Playback still failed the first time i tried, however my project directory was too deep within my file structure, so I moved it to the root of my disk and everything worked fine. Cheers. Nick

Monday, 23 Jun 2008 03:48 by Liam Cleary
Hi, I have posted a workaround/fix to this if you need it. http://www.helloitsliam.com/archive/2008/06/23/moss2007-testing-with-vs-2008-response-to-comments.aspx Liam

Thursday, 31 Jul 2008 06:45 by Turkey
Thanx You.. Perfect Docs

Tuesday, 2 Sep 2008 07:00 by ReejeM
Hi Liam, I've tried doing the steps you've mentioned above. Unfortunately I get the case below :( Object reference not set to an instance of an object. at Microsoft.SharePoint.ApplicationPages.UploadPage.get_CurrentFolderServerRelativeUrl() at Microsoft.SharePoint.ApplicationPages.UploadPage.UploadFile(String& leafName, SPVirusCheckStatus& checkStatus, String& virusMessage) at Microsoft.SharePoint.ApplicationPages.UploadPage.UploadFile() at Microsoft.SharePoint.ApplicationPages.UploadPage.OnSubmit(Object o, EventArgs e) at System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) at System.Web.UI.HtmlControls.HtmlInputButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Monday, 6 Oct 2008 07:41 by lohith babu
Hi Liam, I am having an activeX contorl for uploading the content in the web page. When i tried to execute the webtest for uploading the file it displays the following error message "Your Security settings donot allow websites to use ActiveX control installed on your computer." . FYI i am using trial version of VS TEam. Pls do let me know how to resolve this issue. The activeX control is successfully installed in the machine i am getting an error when i execute from the Visual studio. Your suggestions pls. Thanks

Thursday, 18 Dec 2008 03:06 by SantMoss
Liam, Did you ever post the testing project mentioned in this post? "This is just a basic example of using Visual Studio 2008 Team System for testing. In another post I will share the project that I have created for testing. It can be used to test things such as: Page Access My Site Access and Creation Site Creation and Deletion Upload Single and Multiple Documents Searching "

Friday, 20 Mar 2009 06:36 by Pradeep
Hi All, I used to face the same error "Request failed: Context parameter '$HIDDEN1.__EVENTTARGET' not found in test context " but after upgrading to SP1 this solved.

Thursday, 14 May 2009 01:44 by Sails
Hi, I have just tried to record uploading a file to a Sharepoint Server and I did get an error at first. Then I edited the File Upload Parameter and changed the filename to file path and it worked fine. But when I first recorded the web test I checked in the file and when I ran the test again I still got errors. So I rerecorded the web test again without checking the file in and it worked fine. One other problem that I am having is that when I load the home page for sharepoint during the test I get a 404 notfound for a jpeg image. Any ideas on how to solve this issue? It's not a big deal but would like to have all green ticks next to each request. Thanks

Tuesday, 16 Jun 2009 10:22 by Saurabh
Hi, Can someone help me understand how I can use a context parameter (added in my web test) in a parameterized Form Post Parameter Input? Thanks

Thursday, 8 Oct 2009 07:10 by Cinzpinz
Hi there, I know this is way off the topic. I wanted to know if there is any way that I could test mandatory fields in a web test?

Name:

URL:

Email:

Comments: