Welcome to my blog on all things SharePoint. I have a range of articles that will interest you if you've made it as far as visiting my blog. I was awarded as an SharePoint MVP by Microsoft in July 2010. I currently live in New York and am an Enterprise Architect at AvePoint Inc.. I co founded www.NothingButSharePoint.com with Mark Miller in 2010.

MVP AwardJeremy Thake Profile Photo

Whitepapers

NBSP

Check out my articles on NothingButSharePoint.com

Solution Development in SharePoint 2007

This series was inspired by the chatter amongst SharePoint blogs on the best ways to approach customisations in SharePoint using Solutions.

Part 1 - Part 2 - Part 3 - Part 4 - Part 5 - Part 6 - Part 7 - Part 8

Leveraging the SharePoint Platform

This series was inspired by a discussion had with Andrew Coates at a Perth SharePoint User Group meeting. This then turned into a 6 part series on Arno Nell's SharePointMagazine.net web site.

Initial post - Part 1 - Part 2 - Part 3 - Part 4 - Part 5 - Part 6

Webcasts

I have recorded various web casts that I present at User Groups or just on a specific topic by request:
How ASP.NET Developers can leverage SharePoint webcast
SPSource Webcast: Reverse engineer Lists to ListTemplates and much more
SharePoint Development with Unit Testing webcast
Perth SharePoint UG Web Cast on approaches to deploying artefacts (SPSource)
More...


Podcasts

I have been interviewed about Leveraging the SharePoint Platform by the SharePoint Pod Show: listen here .

RSS Feed Feed your read!

Archives

March 2012 (1)
February 2012 (1)
January 2012 (5)
September 2011 (2)
August 2011 (1)
July 2011 (3)
June 2011 (7)
May 2011 (3)
April 2011 (3)
March 2011 (3)
February 2011 (2)
January 2011 (1)
December 2010 (4)
September 2010 (4)
July 2010 (5)
June 2010 (4)
May 2010 (6)
April 2010 (7)
March 2010 (5)
February 2010 (7)
January 2010 (3)
December 2009 (1)
November 2009 (6)
October 2009 (9)
September 2009 (7)
August 2009 (6)
July 2009 (13)
June 2009 (4)
May 2009 (12)
April 2009 (4)
March 2009 (4)
February 2009 (13)
January 2009 (4)
December 2008 (4)
November 2008 (11)
October 2008 (16)
September 2008 (4)
August 2008 (5)
July 2008 (4)
June 2008 (8)
May 2008 (5)
April 2008 (9)
March 2008 (5)
February 2008 (6)
January 2008 (1)
November 2007 (11)
October 2007 (8)
September 2007 (24)
August 2007 (5)
July 2007 (2)
May 2007 (1)
April 2007 (1)
March 2007 (1)
February 2007 (3)
January 2007 (4)
November 2006 (7)
October 2006 (7)
September 2006 (18)
August 2006 (14)
June 2006 (3)
May 2006 (8)
April 2006 (4)
March 2006 (38)
February 2006 (30)
January 2006 (2)
December 2005 (3)
November 2005 (28)
May 2005 (1)
April 2005 (5)
March 2005 (1)
November 2004 (1)
August 2004 (11)
July 2004 (1)
Failed to render control: An error occurred during a call to extension function 'createMonthUrl'. See InnerException for a complete description of the error.

Links

Tag Cloud

Ajax, Apple, DotNetNuke, Enterprise Content Management, Error Resolution, Gadgets, General, Governance, Microsoft .Net Development, Mobile, SharePoint, Sharepoint Business Forms, Sharepoint Business Intelligence, Sharepoint Collaboration, SharePoint Development, Sharepoint Enterprise Content Management, Sharepoint Enterprise Search, Sharepoint Portal, US Migration, Web 2.0, Workflow

SharePoint Web Testing with Visual Studio Team System 2010 Team Suite beta   

Tags:

So I’m sitting on the plane on the way back to Perth for the weekend and thought I’d throw together a post on the new improved Web Testing capability within Visual Studio Team System 2010 beta .

I remember first getting Visual Studio Team System 2008 Team Suite and trying the Web Testing capabilities with SharePoint. It failed horribly due to the way in which SharePoint renders it’s XHTML.

Fortunately with 2010, the approach has got a lot better, but will still require some custom coding. The immediate benefit is that it gives you the Visual Studio IDE.

The below scenario does highlight a few issues that we’ll have in the SharePoint World with using Web Tests.

Create Test Project

Selection File | New Project from Visual Studio gives you a much improved New Project window:

image

 

You’ll get a load of waffle about tests in a .txt document:

image  and a project structure:

image

New Web Test

So I’m interested in creating a new Web Test:

image  

Immediately a Windows Internet Explorer (yes it’s IE only) window pops up with a Web Test side bar:

image It’s defaulted to start recording immediately any actions I do within Internet Explorer.

For a typical scenario I wanted to record going into a SharePoint Team Site, creating a new List, adding a custom Site Column, and then creating a new List Item. I then want to replay this test on a new SharePoint Team Site to see whether it’ll replay and create the things the same.

image

As you can see from above team site, it records your steps as you go along. Clicking stop, closes Internet Explorer and returns you back to Visual Studio.

Dynamic Parameters

It’ll go through and detect dynamic parameters for you:

imageIn this scenario it detected:

image

Which it found on the newform.aspx as a hidden <input> form variable. Looking in the View Source in IE I found:

<INPUT id="__EVENTTARGET" type="hidden" name="__EVENTTARGET" value="" />

Obviously this was not going to be of any use. After this the test appears in the main panel:

image

First Hurdle: Error re-running Test

In the Test Results, it actually showed up with this:

image basically it tried to run the Test again in the same site...and failed. Clicking on the failure gives you more details:

image Not very detailed unfortunately.

Changing URLs

Looking further at the steps…to get this test to re-run in a new environment I need to change the url in the steps:

image

Parametersing Web Servers

Now I can paramaterise the web server, but that is not going to help as it is a sub site collection off the main Web Application I wish to change and this option will only do the root url:

image

Generate Code

Clicking the Generate Code button:image Creates a C# equivalent Web Test (much like WATIN recorder does):

image

The beauty of this is I can no do a find and replace, or even parameterise the site url:

image You can then open the new “Coded Test” and run this:

image

Immediately I noticed I get an exception error on a step. Searching in my Coded Test I found:

request10Body.FormPostParameters.Add("AddToAllContentTypes", this.Context["$HIDDEN1.AddToAllContentTypes"].ToString());

For some reason this isn’t in the Context of the page when it is executed in this instance…but I got green lights on all the other steps?!? I then noticed above in that step:

request10.QueryStringParameters.Add("NextUsing", "http%3A%2F%2Fwin%2D0xqbnqw37uf%3A81%2Fsites%2FDevSite%2F%5Flayouts%2FListEdit%2Ea" + 
        "spx%3FList%3D%257BB84E37C2%252D4D8D%252D43B3%252DADCA%252DD8F18789892B%257D", false, false); 

So the QueryString is being added to the page and as you can see there is an encoded url that I missed! Looking further there were quite a few encoded urls, so I had to parameterise these too!

This time when I re-run, I could see that it was staying on teh StagingSIte now but I was still getting the same error…you can actually click on each step in the Web Test and see what page was rendered. Clicking through from beginning I got this error:

image

So the listedit.aspx page was getting an error, immediately I noticed that the listedit.aspx is hanging off the layouts directory and has no context of the list…so figured the ListId is in the form post or something…

request7.QueryStringParameters.Add("List", "%7BB84E37C2%2D4D8D%2D43B3%2DADCA%2DD8F18789892B%7D", false, false);

So I need to pass the Guid of the List through…this is suddenly getting a lot bloody harder than it should be! Poking around in the view source of the page from the step before the listedit.aspx (where I clicked on the List Settings I found this:

<a href="/sites/StagingSite/_layouts/listedit.aspx?List=d1d50bba-78ce-4c36-92b5-84ef88b45a4b">Modify settings and columns</a>

So potentially I could go and Extract this url rather than it explicitly setting it.

Limitations

But really i just want to tell the Web Test to click on the Hyperlink because I know that the hyperlink does the query string correctly rather than me forcing it!

This seems to be a limitation of how the Web Tests work as it seems dependent on server side Form Posts and Query Strings for tests. Obviously this is not going to be very useful for very dynamic AJAX orientated sites where it may be dependent on where the user clicks on the screen as apposed to predetermined form post and query string parameters.

If anyone can prove me wrong about this stuff I’d really appreciate it!

Other Neat Features

Changing Parameters

You’ll also notice further down where the newform.aspx action is handled that there are various FormPostParameters added as this is how the newform.aspx operates…as it’s an ASP.NET at heart ;-)

image

I can then start doing things like replacing:

request5Body.FormPostParameters.Add("Title", "Test");

with parametised titles:

request5Body.FormPostParameters.Add("Title", newListTitle);

This can be extended further by having a data source, say for instance a SQL Database Table with rows and repeating this test for each row using the test data in the table.

Validation Rules

Also at the bottom of the Web Test are various ‘Validation Rules’ it creates by default:

imageOther Validation rules can be added to validate a web test:

imageThis could come in handy to check the redirected url is correct, or the response time of the page, or that certain text is on the page etc.

 
Posted by  Jeremy Thake  on  5/22/2009
0  Comments  |  Trackback Url  | 0  Links to this post | Bookmark this post with:        
 

Links to this post

Comments

blog comments powered by Disqus