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   REST Services   Search Server   Security   SEO   SharePoint   SharePoint 2010   Silverlight   SQL   Tech Ed 2008   Testing   Vista   VSTO   WCF   WSS   XSL

[23/06/2008] MOSS2007 Testing with VS 2008 Response to Comments
 
Categories: Office System 2007, SharePoint, Testing, WSS, Development
 

A while ago I posted about using Visual Studio to performance and stress test your SharePoint environment. A few people have posted comments about an error they face; this error is also prevalent on the Microsoft forums as well. I actually had one of my colleagues ask me how to fix this exact error today and remembered that I had not yet posted this. So here goes for those of you who get the following error after recording let's say a document upload in SharePoint this is the workaround I use.

Firstly let's look at what Visual Studio outputs to the recoding pane within internet explorer.

Some of the lines above are not needed; this list above is the recording of the following steps:

  1. Access Home Page
  2. Access team site called "SampleTestSite"
  3. Access the "Shared Documents" library
  4. Click the "Upload" button in the document library
  5. Select a test document and then upload
  6. Confirm the content type and then save

The most important line that we need in this test is the line showed below:

To fix the problem there are a couple of things you can do, the first is to check the name of the "Extraction Parameter" within the recoding.

If you check the properties, you might find it is named something like the below:

Simply rename this to "1" and your "HIDDEN1.__EVENTTARGET" will work. The thing to remember is that the field call to "$HIDDEN1" is actually simply concatenating the word "$HIDDEN" and the "Extraction Parameter" name together. CHECK THIS ONE FIRST!!

The other alternative is to reconstruct some of the code manually, some of this you will need to do anyway to make it work correctly. Remove the following line from the recording pane in Visual Studio.

Once we have removed the highlighted lines the recording should look like the following:

Now we have stripped our recording to the bare minimum, we need to copy the "Upload" line.

Simply paste this and it will show up below the first "Upload" line.

So now we have two lines for uploading we need to modify the second line slightly, firstly remove the extraction rule as this is done in the previous line.

Once this line has been removed we need to add some "Form Post Parameters".

The list of parameters is shown below:

Once we have these added your project should now work and not error with the error shown above. Whichever way you fix the problem when the project is run it should look something like this:

 

 

 
4 Comments
 

Comments

Thursday, 19 Mar 2009 06:51 by Pradeep
After following the steps, i am still facing the same problem Request failed: Context parameter '$HIDDEN1._EVENTTARGET' not found in test context

Wednesday, 22 Jul 2009 02:38 by Nick Tulett
Pradeep have you included your user name and password either as Credentials in the web test or explicitly in the coded test?

Thursday, 5 Nov 2009 11:14 by Manuel Andrade
Please note that the server dos not send _EVENT* fields for some browsers.

Thursday, 14 Jan 2010 08:55 by Adam
Liam, Very useful article, very clear. Do you also have an example of recording a File upload in WSS 2.0? The Web Test Recorder in VS2008 doesn't show any kind of postback, It appears to call a Javascript function called ClickOnce if I "view source". Is it implemented differently in the two products? Regards Adam

Name:

URL:

Email:

Comments: