<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>21apps &#187; Testing</title>
	<atom:link href="http://www.21apps.com/tag/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.21apps.com</link>
	<description>Inspiring people to change the way they work</description>
	<lastBuildDate>Sun, 05 Feb 2012 17:23:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Slide deck from Automated UI Testing at BPC10</title>
		<link>http://www.21apps.com/sharepoint/slides-ui-testing-bpc10/</link>
		<comments>http://www.21apps.com/sharepoint/slides-ui-testing-bpc10/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 20:22:41 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Public Speaking]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=1399</guid>
		<description><![CDATA[Slide deck from my Automated UI Testing of SharePoint 2010 with Visual Studio 2010 presented at the Best Practices Conferences in Washington DC in August 2010. &#160; Automted testing with visual studio 2010 View more presentations from Andrew Woodward.]]></description>
			<content:encoded><![CDATA[<p>Slide deck from my Automated UI Testing of SharePoint 2010 with Visual Studio 2010 presented at the <a href="http://www.bestpracticesconference.com/" target="_blank">Best Practices Conferences</a> in Washington DC in August 2010.</p>
<p>&#160;</p>
<p> <span id="more-1399"></span>
<div style="width: 425px" id="__ss_5055561"><strong style="margin: 12px 0px 4px; display: block"><a title="Automated testing with visual studio 2010" href="http://www.slideshare.net/AndrewWoody/automted-testing-with-visual-studio-2010">Automted testing with visual studio 2010</a></strong><object id="__sse5055561" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=automtedtestingwithvisualstudio2010-100825151618-phpapp01&amp;stripped_title=automted-testing-with-visual-studio-2010" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed name="__sse5055561" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=automtedtestingwithvisualstudio2010-100825151618-phpapp01&amp;stripped_title=automted-testing-with-visual-studio-2010" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding-bottom: 12px; padding-left: 0px; padding-right: 0px; padding-top: 5px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/AndrewWoody">Andrew Woodward</a>.</div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/sharepoint/slides-ui-testing-bpc10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated UI Testing Tip &#8211; Automating deployment to Solutions Gallery</title>
		<link>http://www.21apps.com/sharepoint/ui-testing-tip1/</link>
		<comments>http://www.21apps.com/sharepoint/ui-testing-tip1/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 19:10:03 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[21Scrum]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=1304</guid>
		<description><![CDATA[As part of the 21SCRUM development project I implemented build verification testing using Visual Studio 2010.  21SCRUM has a great suit of unit tests for the core logic,  it has some integration tests (although I would like more) but I found a lot &#8230; <a href="http://www.21apps.com/sharepoint/ui-testing-tip1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As part of the <a href="http://www.21scrum.com/" target="_blank">21SCRUM</a> development project I implemented build verification testing using Visual Studio 2010.  21SCRUM has a great suit of unit tests for the core logic,  it has some integration tests (although I would like more) but I found a lot of the coding was very targeted at the User Interface.  So much so that no real changes to the core logic have been made since the beta release.</p>
<p>The team did a number of Spike tests <sup>1</sup> to see if it was possible to do unit testing of the JavaScript code.  Unfortunately nothing that was looked at really provided the confidence or ease of use needed to become a part of the development process.</p>
<p>I have flirted with automated UI testing for a long time,  looking at WinRunner, Segue, QA Runner and various other tools along the way.  I actually remember doing UI testing against a FoxPro application that used OCR technology to verify the text on the screen.  The problem has always been that the tests are brittle, any slight changes to the UI and they break and it becomes a case of diminishing returns.  However having failed to find a good solution to unit testing the UI code I decided to give the new Visual Studio 2010 tools a look.</p>
<p>My first impressions were very good,  I actually changed the session I was doing at the SUGUK event in Wolverhampton due to being so impressed by the tools.  This post is going to be one of a number I do covering lessons learned as the team develop our test suite using these tools for real on 21SCRUM.  </p>
<p>The first lesson and one that you need to do before you start any UI testing is start from a known place.</p>
<h3>Start from a known place</h3>
<p>I quickly discovered that getting good, repeatable and maintainable automated UI tests to work over time you really have to make sure you always start at the same place.  This means no additional browser windows open,  no test web parts added to your pages, no left over&#8217;s from the last test or development.   </p>
<blockquote><p>One of the reasons I love Unit Testing is the isolation for any real environment or the need to go through a lot of setup and tear down steps.</p></blockquote>
<p>In order to do this properly and repeatedly you need to have a script that will refresh your test location.</p>
<p>The script used for 21SCRUM is simple and does the following:</p>
<ul>
<li>- Deletes the test site collection</li>
<li>- Create the test site collection based on required site template</li>
<li>- Uploads the 21SCRUM sandboxed solution to the Solution Gallery</li>
<li>- Activate the 21SCRUM solution</li>
</ul>
<p>These steps ensure that when the tests are run they always start from a clean site collection.   The script has been extended to provided sub sites and additional site collections but the changes are incremental and added as the tests demand.</p>
<h3>Powershell</h3>
<p>Like all good developers Powershell is the scripting language of choice.  Actually kicked off with a good old fashioned .bat file &lt;&lt;  interested to know if there are any alternatives to this?</p>
<p>The batch file RefreshSite.Bat  (powershell.exe is in my standard path)</p>
<pre>powershell -File RefreshSite.ps1</pre>
<p>The powershell script does the work</p>
<p><span style="font-family: Courier New;">//Load the SharePoint Commandlets</span></p>
<p><span style="font-family: Courier New;">Add-PSSnapin Microsoft.SharePoint.Powershell</span></p>
<p><span style="font-family: Courier New;">//Delete the site collection – don’t prompt the user to confirm</span></p>
<p><span style="font-family: Courier New;">Remove-SPSite -Identity &#8220;http://aberdovey.com&#8221; -Confirm:$false</span></p>
<p><span style="font-family: Courier New;">//Create a new site collection based on the Team Site Template</span></p>
<p><span style="font-family: Courier New;">Get-SPWebTemplate | Where{ $_.Title -eq &#8220;Team Site&#8221; } | ForEach-Object{ New-SPSite http://aberdovey.com –OwnerAlias DOMAIN\USER -Name &#8220;Aberdovey&#8221; -Template $_ } </span></p>
<p><span style="font-family: Courier New;">//Add the solution to the solution Gallery – it must have the full path name and not a relative path</span></p>
<p><a name="code-7"></a><span style="font-family: Courier New;">Add-SPUserSolution -LiteralPath C:\&lt;full path to the location of the WSP&gt;\21Scrum.Solution.wsp -Site http://aberdovey.com -Confirm:$false </span><a name="code-8"></a></p>
<p><span style="font-family: Courier New;">// Activate the solution – and yes Microsoft have done it again with the naming!  Install means Activate</span></p>
<p><span style="font-family: Courier New;">Install-SPUserSolution -Identity 21Scrum.Solution -Site http://aberdovey.com -Confirm:$false</span></p>
<p> </p>
<p>This simple command allows the refreshing of the environment to be run quickly and ensures the tests always start from a known place.</p>
<p> </p>
<blockquote><p><sup>1</sup> Spike Tests &#8211; short time-boxed pieces of work looking to prove an approach or providing additional knowledge to make estimates more accurate.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/sharepoint/ui-testing-tip1/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Call for common code &#8211; Can we unit test it</title>
		<link>http://www.21apps.com/sharepoint/call-for-common-code-can-we-unit-test-it/</link>
		<comments>http://www.21apps.com/sharepoint/call-for-common-code-can-we-unit-test-it/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 16:53:39 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=1218</guid>
		<description><![CDATA[One of the challenges with unit testing SharePoint projects is the need to fake the calls into SharePoint.  If you are a regular reader of my blog you will have seen examples of how I have been doing this using &#8230; <a href="http://www.21apps.com/sharepoint/call-for-common-code-can-we-unit-test-it/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the challenges with unit testing SharePoint projects is the need to fake the calls into SharePoint.  If you are a regular reader of my blog you will have seen examples of how I have been doing this using Typemock Isolator. </p>
<p>Microsoft have their own isolation framework called moles.  A more accurate descripition would be isolation through detours and stubs.  Moles was developed to support <a href="http://research.microsoft.com/en-us/projects/pex/" target="_blank">Pex</a> white box testing and one interesting development from within the team has been Behaviours.  Behaviours are really a way to model the thing you want to isolate for the test without needing to define every isolation point. </p>
<p>Isolatation frameworks (regardless of technology) can result in brittle code, test code that is very tightly linked to the production code.   A simple change from List.GetItems() to List.Items[""] will cause the test to fail.</p>
<p>One of the samples provided with Pex is the modelling of SharePoint Behaviour that will make it much easier for people to be able to create robust tests with minimal or no additional isolation code needed.   Part of the work we are doing is to drive out the things that need to be modelled and reporting these to the Pex team.  It is not going to be easy to model the whole of SharePoint from day one,  however it should be possible to cover the areas most used.</p>
<p>This is where I would like some help.     Do you have any code that you use often,  code that you would like to unit test that takes a long time to isolate and that end up being brittle?</p>
<p>Please post examples here in the comments and we will try to get as much covered as possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/sharepoint/call-for-common-code-can-we-unit-test-it/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Small steps for testing, big steps for SharePoint testing</title>
		<link>http://www.21apps.com/sharepoint/small-steps-big-steps-for-sharepoint-testing/</link>
		<comments>http://www.21apps.com/sharepoint/small-steps-big-steps-for-sharepoint-testing/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 08:55:17 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[TypeMock]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=977</guid>
		<description><![CDATA[Following on from my rant response yesterday about the more negative views from the SharePoint community my reading this morning was so much more positive. Unit Testing Workflows In my response to a question from Aaron Weiker I said that &#8230; <a href="http://www.21apps.com/sharepoint/small-steps-big-steps-for-sharepoint-testing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Following on from my <span style="text-decoration: line-through;">rant</span> <a href="http://www.21apps.com/sharepoint/tdd-and-sharepoint-is-it-worth-doing/">response</a> yesterday about the more negative views from the SharePoint community my <a href="http://blog.typemock.com/2009/06/problem-solving-with-isolator.html" target="_blank">reading</a> this morning was so much more positive.</p>
<h3>Unit Testing Workflows</h3>
<p>In my response to a question from <a href="http://www.21apps.com/sharepoint/tdd-and-sharepoint-is-it-worth-doing/#disqus_thread">Aaron Weiker</a> I said that I would like to see much more guidance and investigation into the way we approach Unit Testing workflows in SharePoint,  so it was great to find Richard Fennell is doing a lot of work in this area.  I have been working with Typemock Isolator, CThru and SilverUnit testing recently (post coming) and was very interested to see that Richard had <a href="http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2009/06/22/logging-everything-that-is-going-on-when-an-assembly-loads-using-cthru.aspx" target="_blank">picked up this</a> whilst looking for a <a href="http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2009/04/07/testing-sharepoint-workflows-using-typemock-isolator-part-3.aspx" target="_blank">possible solution to the challenges</a> of Unit Testing SharePoint workflows; something I have to confess I had not even considered.</p>
<p>I&#8217;m looking forward to seeing where Richard gets with this and also the use of <a href="http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2008/10/04/running-fitness-net-tests-in-unit-test-some-tips.aspx" target="_blank">Fit/Fitness</a>, although I&#8217;m personally not a big fan of the way tables are used to define the tests.</p>
<h3>Integration Testing SharePoint from MSTest</h3>
<p>Having been a bit behind with my reviews of the latest <a href="http://spg.codeplex.com/" target="_blank">Codeplex P&amp;P</a> project I missed the discussion with Francis on how they found a use for <a href="http://blogs.msdn.com/francischeung/archive/2009/06/24/using-typemock-isolator-for-integration-tests.aspx" target="_blank">Typemock Isolator to do Integration tests</a>.</p>
<p>The code is really very very simple,  many will be glad to hear, and deals with the places where your code makes a call to SPContext.Current or SPFarm.Local.</p>
<p>The simple ideas really are the best ones.</p>
<p>As you can see,  a few small steps for testing but big steps for SharePoint testing and a demonstration that in general the SharePoint community is committed to improving the way solutions are developed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/sharepoint/small-steps-big-steps-for-sharepoint-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Doing Agile in a Team of One &#8211; Day 2 and the End of Sprint 1</title>
		<link>http://www.21apps.com/agile/doing-agile-in-a-team-of-one-day2/</link>
		<comments>http://www.21apps.com/agile/doing-agile-in-a-team-of-one-day2/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 10:30:37 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Test Driven Development]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=969</guid>
		<description><![CDATA[I recently wrote about my experience of doing agile development in a team of one,  where I questioned the idea that &#8216;If your the only member of the team is it really worth going through the same agile development process &#8230; <a href="http://www.21apps.com/agile/doing-agile-in-a-team-of-one-day2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently wrote about my experience of doing <a href="/agile/doing-agile-in-a-team-of-one/">agile development in a team of one</a>,  where I questioned the idea that &#8216;If your the only member of the team is it really worth going through the same agile development process that you would in a team of eight?&#8217;</p>
<p>One interesting test for the project was that it was not going to be developed in one go,  the days spent on this project would need to fit around other work and I want to see how using agile techniques could help to keep the momentum and also retain the knowledge from the previous activities in a format that would be easy to pick up.</p>
<p>Sprint 1 &#8211; Day 1 was 15th May 2009</p>
<p>Sprint 1 &#8211; Day 2 was 4th June 2009 a full 20 days gap!</p>
<h3>Daily Scrum</h3>
<p>Always start the day with a scrum and ensure that you come prepared.  This meant that I needed to be able to answer the following questions</p>
<ul>
<li>What did you achieve yesterday?</li>
<li>What are you going to achieve today?</li>
<li>Any blockers preventing you from doing this?</li>
</ul>
<p>Take a minute,  try and think back 20 days and remember exactly what you had achieved?   Difficult isn&#8217;t it!  This is where using a process really helped,  I started by looking at the my white board to see where I left the project.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/06/441.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="441" src="http://www.21apps.com/wp-content/uploads/2009/06/441-thumb.jpg" border="0" alt="441" width="588" height="393" /></a></p>
<p>Interestingly I had not &#8216;Done&#8217; anything (refer to <a href="http://www.21apps.com/agile/doing-agile-in-a-team-of-one/">Day 1</a> for the definition of Done and how I structure my white board), my Burndown for Day 1 was looking very sad so I won&#8217;t even show it.  What I could however see was that I had completed the work on one story,  the second story was in progress and that I had not started the 3rd.  The observant will also notice I have a couple of new stories in the backlog.</p>
<p>If I had not been working on the project for the past 20 days how come there are new stories?</p>
<p><strong>Adding to the Backlog</strong></p>
<p>One of the tenets of being agile is that you work at a sustainable pace,  you don&#8217;t do more work than is possible and you allow your team to go home, see the family and have a beer or two.  What happens when you team is having that beer?  They think about work, and have ideas about ways to do things or new requirements and then write these down as new stories.  The same is true for the business, whilst the team is busy working on the current iteration the business is thinking about what they need, reacting to change and then feeding this into the backlog as new stories.  They may even take away some stories that are no longer needed.</p>
<p><strong>What does this mean?</strong></p>
<p>Well for Sprint 1 nothing,  we have agreed a short period of work where we can focus on the deliverables.   The new stories will be considered for Sprint 2 and for any removed stories we will have the warm feeling that we had not spent too long on in big up front design tasks and documentation.</p>
<h3>The Rest of Day 2</h3>
<p>After the scrum I reviewed the solution I had put together,  and compared this to the stories.  At the end of Day 1 I had a WSP  and some features that meant I could see what I had done and actually use it.  The ability to use the solution very early in the process is another of the big benefits to being agile.  It allows people to see it for real, to make comment and also to make changes if it is not how they envisaged it.</p>
<p>Needless to say I made some changes,  there were bits that I had added that on reflection were not required,  I removed the extra items and did some refactoring of the solution to make it more compact and understandable.</p>
<p>The rest of the day went pretty well,  and at the end of Sprint 1 I had not actually written any C# code or created any Unit Tests.  The solution at the end of the sprint I had completed the three stories I had planned.  I have to confess that I did do a few extra hours work at the end of this day (Sprint) in order to complete the stories. This can be a common scenario where the a stress levels and work will increase towards the end of the Sprint.  The same if true of Waterfall projects but at the end of these projects there is just so much more that is expected to be done the stress levels go off the scale.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/06/stress.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Stress" src="http://www.21apps.com/wp-content/uploads/2009/06/stress-thumb.png" border="0" alt="Stress" width="640" height="294" /></a></p>
<p><strong></strong></p>
<p>The final tasks for the end of Sprint 1 was to do a &#8220;Show and Tell&#8221; to the business.  To make this more real,  and to be able to provide a summary once the project is released I record a Screencast demonstrating what had been done.   It may sound silly doing the screen cast or doing a show and tell to yourself, however what it does do is make you bring together everything and ensure that what you said was done, actually was done.</p>
<h3>Sprint 1 Retrospective</h3>
<p>In order to improve our processes, to produce better quality solutions and to make ourselves more productive we need to look at what happened in the Sprint, the good things as well as the challenging ones and also look for ways to improve.</p>
<p><strong>Things that went well</strong></p>
<ul>
<li>Adopted great agile techniques</li>
<li>Was able to pickup after a break</li>
<li>Good use of tools like WSPBuilder and hosted source control</li>
</ul>
<p><strong>Things to improve on</strong></p>
<ul>
<li>Testing was manual &#8211; need more automation of integration and acceptance tests</li>
<li>Testing was on single machine &#8211; need to test on multi server farm configuration</li>
<li>Project break was too long &#8211; final delivery will be too late at current pace</li>
</ul>
<p>If you want to learn how to be better at retrospectives I recommend getting a copy of <a href="http://www.amazon.com/Agile-Retrospectives-Making-Teams-Great/dp/0977616649" target="_blank">Agile Retrospectives, Making Good Teams Great by Esther Derby and Diana Larsen.</a></p>
<h3>Summary</h3>
<p>Based on the experience so far I can say that adopting agile techniques in a team of one really is something that everyone should do.   I agree just cranking out code some developers could be a fair bit more productive up front than I have been. However if the project takes off and you need to bring in more help or you have a long break the project will eventually fail without these process in place.</p>
<p>And the biggest benefit to doing this is that you learn the benefits of being agile,  you understand why it works and you will be able to add this to your CV and Life experience and go on to become a much better developer.  You will be able to challenge the traditional practices in your organisation based on experience and not just hearsay.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/agile/doing-agile-in-a-team-of-one-day2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Typemock ASP.Net Bundle &#8211; get a free license</title>
		<link>http://www.21apps.com/testing/typemock-aspnet-get-a-free-license/</link>
		<comments>http://www.21apps.com/testing/typemock-aspnet-get-a-free-license/#comments</comments>
		<pubDate>Tue, 19 May 2009 12:25:18 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[TypeMock]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=954</guid>
		<description><![CDATA[One of my favourite tools Typemock has just been released in a fantastic ASP.Net bundle and have once again offered this up to the blogging community to get for free. Unit Testing ASP.NET? ASP.NET unit testing has never been this &#8230; <a href="http://www.21apps.com/testing/typemock-aspnet-get-a-free-license/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of my favourite tools Typemock has just been released in a fantastic ASP.Net bundle and have once again offered this up to the blogging community to get for free.</p>
<p><a href="http://www.typemock.com/">Unit Testing</a> ASP.NET? <a href="http://www.typemock.com/ASP.NET_unit_testing_page.php">ASP.NET unit testing</a> has never been this easy.<br />
Typemock is launching a new product for ASP.NET developers &#8211; the <strong>ASP.NET Bundle</strong> &#8211; and for the launch will be giving out <strong>FREE licenses</strong> to bloggers and their readers.<br />
The ASP.NET Bundle is the ultimate ASP.NET unit testing solution, and offers both <a href="http://www.typemock.com/">Typemock Isolator</a>, a <a href="http://www.typemock.com/">unit test</a> tool and <a href="http://sm-art.biz/Ivonna.aspx">Ivonna</a>, the Isolator add-on for <a href="http://sm-art.biz/Ivonna.aspx">ASP.NET unit testing</a>, for a bargain price.<br />
Typemock Isolator is a leading <a href="http://www.typemock.com/">.NET unit testing</a> tool (C# and VB.NET) for many &#8216;hard to test&#8217; technologies such as <a href="http://typemock.com/sharepointpage.php">SharePoint</a>, <a href="http://www.typemock.com/ASP.NET_unit_testing_page.php">ASP.NET</a>, <a href="http://www.typemock.com/ASP.NET_unit_testing_page.php">MVC</a>, <a href="http://www.typemock.com/wcfpage.php">WCF</a>, WPF, <a href="http://www.typemock.com/Silverlight_unit_testing_page.php">Silverlight</a> and more. Note that for <a href="http://www.typemock.com/Silverlight_unit_testing_page.php">unit testing Silverlight</a> there is an open source Isolator add-on called <a href="http://www.typemock.com/Silverlight_unit_testing_page.php">SilverUnit</a>.<br />
The first 60 bloggers who will blog this text in their blog and <a href="http://blog.typemock.com/2009/05/get-free-typemock-licenses-aspnet.html">tell us about it</a>, will get a Free Isolator ASP.NET Bundle license (Typemock Isolator + Ivonna). If you post this in an ASP.NET <strong>dedicated</strong> blog, you&#8217;ll get a license automatically (even if more than 60 submit) during the first week of this announcement.<br />
Also 8 bloggers will get an <strong>additional 2 licenses</strong> (each) to give away to their readers / friends.<br />
Go ahead, click the following link for <a href="http://blog.typemock.com/2009/05/get-free-typemock-licenses-aspnet.html">more information </a>on how to get your free license.</p>
<p>I&#8217;ve not had the chance to try out the Ivonna or SilverUnit add-ons to the framework yet, but will be looking at these in the near future and they can help you test more of your SharePoint solutions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/testing/typemock-aspnet-get-a-free-license/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Doing Agile in a Team of One</title>
		<link>http://www.21apps.com/agile/doing-agile-in-a-team-of-one/</link>
		<comments>http://www.21apps.com/agile/doing-agile-in-a-team-of-one/#comments</comments>
		<pubDate>Fri, 15 May 2009 22:10:06 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Test Driven Development]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=950</guid>
		<description><![CDATA[If your the only member of the team is it really worth going through the same agile development process that you would in a team of eight? Isn&#8217;t it quicker to just crack open Visual Studio and start coding?   After &#8230; <a href="http://www.21apps.com/agile/doing-agile-in-a-team-of-one/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If your the only member of the team is it really worth going through the same agile development process that you would in a team of eight?</p>
<p>Isn&#8217;t it quicker to just crack open Visual Studio and start coding?   After all your the customer so you know what you want right?   You not going to have to deal with any of the social complexities that conspire against you. You&#8217;re going have the hottest of communication with the dev team,  the dev and test roles will have an interment knowledge and the scrum master won&#8217;t really have to do anything as there is not going to be any blockers on this project.</p>
<p><strong>Right?</strong></p>
<p>So I started down this path and before I knew it I had some weird project created with bits of code and SharePoint artefacts but not really seeming to make any progress.   I was easily distracted by other things and didn&#8217;t really have a feel for how long it would take and when I could say I was done.</p>
<p><strong><span style="font-size: medium; color: #ff0000;">STOP!</span></strong></p>
<p>What was I doing!  I spend my time trying to help people develop better, to take small steps and sometimes big steps to help produce better software..   why was I not practicing what I preached?</p>
<p><strong>I stopped!</strong></p>
<p>Deep breath, deleted all the rubbish I can previously created and got back to basics.</p>
<h3>The Team</h3>
<p>I have a team,  the fact that some (in this case all) of the roles were done by the same person was ok; that happens often in agile teams.</p>
<h3>Design</h3>
<p>Yes, you heard me right here.  <a href="http://www.binarywave.com/blogs/eshupps/default.aspx" target="_blank">Eric Shupps</a> would be proud of me <img src='http://www.21apps.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .   I&#8217;m not going to jump into Visual Studio and crank out code starting [TestFixture] I need to do some design work first, even though this application is going to be small I still need to put in the time on the upfront design.  I need to think through the solution at a high level.</p>
<p>Here I used the opportunity to try out the great <a href="http://www.balsamiq.com/" target="_blank">Balsamiq</a> application,  which I stumped up the $79 license fee for and download the desktop version.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/05/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="Blurred out Balsamiq Design" src="http://www.21apps.com/wp-content/uploads/2009/05/image-thumb.png" border="0" alt="Blurred out Balsamiq Design" width="612" height="480" /></a></p>
<p>I&#8217;ve deliberately blurred the image but you get the idea of what the mock ups look like, and these take only a matter of minutes to produce.  Definately something you should consider if your currently trying to do this in Visio or heaven forbid cranking out HTML mockups.</p>
<p>The few UI based mockups actually helped me to understand how the application would work for the end user, which in turn provided a clear vision for the way the solution would be developed.</p>
<h3>User Stories</h3>
<p>I didn&#8217;t need to do any remote collaboration on the User Stories so I was able to get back to basics and use one of the white boards in my office as the task board.   I wrote the user stories out on post-it notes and added them to the board along with rough estimates for each one.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/05/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/05/image-thumb1.png" border="0" alt="image" width="635" height="484" /></a></p>
<p>Here you can see I&#8217;m using a very common step of status on my task board</p>
<p><strong>Backlog </strong>- This is where I add all stories that came out of the design,  they are all user focused with nothing specific about the implementation.  No stories like &#8216;Use jQuery to make it nice&#8217;  these are user stories.  If I think of something while i&#8217;m coding or testing, or even having a beer I can just write it to a post-it and stick it on the backlog.</p>
<p><strong>Sprint</strong> &#8211; I like Scrum so adopt a Scrum Esq. style to my process.  The sprint will be where I put the stories I plan to do next.  The amount is based on the estimate and also the sprint length.   In this project I&#8217;m doing stupily short sprints of 2 days each.</p>
<p><strong>In Progress &#8211; </strong>When I pick off a story to work on it goes in here,  if you&#8217;ve ever looked at the Kanban approaches your looking to keep this &#8216;In Progress&#8217; to a defined level.  I like to try and move things through to &#8216;Done&#8217; before picking off new stories.</p>
<p><strong>Verify</strong> &#8211; When I think it&#8217;s been coded properly and dev tested I move the story here.   Verify is where I would validate the code on another environment &#8211; i.e. a non-dev box,  one with multiple web front ends.  At this point I also look at introducing some form of automation for both the build/deployment and also the acceptance testing.</p>
<p><strong>Done</strong> &#8211; This is when it is really really done,  there is nothing left to do, no documentation, no tests or tweaks,  the code is production ready.</p>
<h3>Sprint 1 &#8211; Day 1</h3>
<p>Having selected the user stories for the sprint it was time to setup my dev project and get some of the foundations in place.   If you follow me on twitter you will know that I previously spent time producing a decent SharePoint development Virtual Machine so it was very quick for me to roll out the few things I needed to get going.   A SharePoint team site in which I could spike and test my code,  a VS2008 solution and class library project in which to start cranking out some code.</p>
<p>At the end of Day 1 my board looked like this:</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/05/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/05/image-thumb2.png" border="0" alt="image" width="638" height="484" /></a></p>
<p>One of the stories I felt was ready for verification and another I was making good progress on.   At this point I had nothing &#8216;Done&#8217; my burndown in the morning would look a bit sad,  but that&#8217;s OK that is often the case at the start of a project or sprint.  I also don&#8217;t at this point have a verification setup so this is going to slow me down a bit on Day 2.</p>
<p>Day 1 has been good,  I have the basic project structure defined.   I was able to build a WSP with the SharePoint features I needed to complete the first story and was able to deploy and test this on my dev machine.</p>
<p>People that have read my blog or seen me talk at conferences and user groups know that I am very keen on doing things right; I like to see Unit Tests and better still I want to see people at least trying Test Driven Development.   However at the end of Day 1 I was yet to write a single line of C# code, neither in test form or production code.   So did I really do development on day one?</p>
<p>Well I think I did, only the language used was XML and a little bit of CAML and for these items I do not know of any way, that makes sense, to unit test.  I often think that the XML we define as part of SharePoint projects are more inline with doing configuration,  we are just setting up SharePoint using a specific configuration and the testing for this should naturally falls into the integration space and will be picked up during verification.   That is not to say as a developer I do not validate it,  I need to ensure that it works as expected in my environment before I can move it over to the Verify column and it&#8217; is the job of the tester to make sure this happens.  For this project the tester (me) was adamant that it all worked as they didn&#8217;t want to have to waste time on silly errors.</p>
<h3>Interesting Test</h3>
<p>One thing that I will be having to do with this project is fit it around real work, the sort that helps to keep food on the table sort of work.   This means that the sprints although 2 days in length the elapsed time may be significantly longer.  I know that this will impact on the velocity as I will lose some of the momentum during these breaks, however the benefit I have from adopting a more defined process is that it will be significantly easier for me to pick up the project.   Imaging if I had to go back to the mess of code I had originally created after a weeks break!</p>
<p>I&#8217;m really interested to see if my agile development with a team of one really does make a significant impact on the way I develop the code, on the time it takes to complete it and on the quality of the solution created at the end.</p>
<p><a href="http://www.21apps.com/agile/doing-agile-in-a-team-of-one-day2/">Find out what happens on Day 2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/agile/doing-agile-in-a-team-of-one/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>More great Unit Testing SharePoint Examples</title>
		<link>http://www.21apps.com/sharepoint/unit-testing-sharepoint-examples/</link>
		<comments>http://www.21apps.com/sharepoint/unit-testing-sharepoint-examples/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 12:21:31 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[TypeMock]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=927</guid>
		<description><![CDATA[Great to see that more people are publishing their experiences with unit testing SharePoint.   Here are some of examples I have found that are really worth looking at: Richard Fennell &#8211; Testing SharePoint Workflows using TypeMock Isolator (part 1, part &#8230; <a href="http://www.21apps.com/sharepoint/unit-testing-sharepoint-examples/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Great to see that more people are publishing their experiences with unit testing SharePoint.   Here are some of examples I have found that are really worth looking at:</p>
<blockquote><p>Richard Fennell &#8211; Testing SharePoint Workflows using TypeMock Isolator (<a href="http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2009/04/03/testing-sharepoint-workflows-using-typemock-isolator.aspx" target="_blank">part 1</a>, <a href="http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2009/04/06/testing-sharepoint-workflows-using-typemock-isolator-part-2.aspx" target="_blank">part 2</a> and <a href="http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2009/04/07/testing-sharepoint-workflows-using-typemock-isolator-part-3.aspx" target="_blank">part 3</a>) &#8211; Richard is also going to be talking at a few <a href="http://www.nxtgenug.net/ViewEvent.aspx?EventID=216" target="_blank">NextGen</a> meetings on the subject.</p></blockquote>
<blockquote><p>SharePoint Dev Wiki is really starting to get some good content not just on <a href="http://www.sharepointdevwiki.com/display/public/SharePoint%20Development%20with%20Unit%20Testing" target="_blank">unit testing</a> but on the whole development field.</p></blockquote>
<blockquote><p>Jeremy Thake (creator of SharePoint Dev Wiki) did a great usergroup meeting web cast on <a href="http://wss.made4the.net/archive/2009/03/25/sharepoint-development-with-unit-testing-webcast.aspx" target="_blank">SharePoint Development with Unit Testing</a></p></blockquote>
<blockquote><p>I&#8217;ve previously mentioned the <a href="http://msdn.microsoft.com/en-us/library/dd206923.aspx" target="_blank">Patterns and Practices</a> work and they have started to do some great <a href="http://channel9.msdn.com/posts/akMSFT/pp-SharePoint-Development-Guidance-v2-Whats-in-Drop-7/" target="_blank">Channel 9 videos</a> which really do make this so much more accessible.  Brilliant Job!</p></blockquote>
<p>If you have any links or posts on the subject please share by adding a link in the comments, and if you&#8217;ve done something new and exciting help the SharePoint Dev Wiki by posting details.</p>
<p>Looks like my predictions are starting to come true,  people really are doing SharePoint development better <img src='http://www.21apps.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/sharepoint/unit-testing-sharepoint-examples/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Improve you SharePoint code with Red Gate ANTS</title>
		<link>http://www.21apps.com/sharepoint/code-profiling-ants/</link>
		<comments>http://www.21apps.com/sharepoint/code-profiling-ants/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 22:20:02 +0000</pubDate>
		<dc:creator>Andrew Woodward</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.21apps.com/?p=881</guid>
		<description><![CDATA[As development practices around the SharePoint platform mature the demands for better quality and better performing solutions are being made.  Gone are the days when Enterprises will accept that the Roll-Up Web Part they purchased will not scale beyond a &#8230; <a href="http://www.21apps.com/sharepoint/code-profiling-ants/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As development practices around the SharePoint platform mature the demands for better quality and better performing solutions are being made.  Gone are the days when Enterprises will accept that the Roll-Up Web Part they purchased will not scale beyond a few site collections.  A knowledge of the platform and defensive coding alone will not cut the mustard, the need for a holistic approach to your development practices will be the only way to achieve success.  In this blog post I am focusing on one specific technique, <strong>code profiling</strong>, and using the excellent <a href="http://www.red-gate.com/Products/ants_profiler/index.htm" target="_blank">Red Gate ANTS Profiler</a>.</p>
<p><em>Disclaimer</em>:  Red Gate ANTS Profiler is a paid for application.  There are other products on the market that do code profiling including Visual Studio.  The reason for using ANTS in this post is due to the ease with which you can get up an running and the quality of the user experience.  I recommend you set aside a day to look at the profiling in Visual Studio and then a few hours to get that much further with ANTS.</p>
<p><a href="http://en.wikipedia.org/wiki/Performance_analysis" target="_blank">Software Performance Analysis</a> &#8211; Wikipedia</p>
<blockquote><p>In <a href="http://en.wikipedia.org/wiki/Software_engineering" target="_blank">software engineering</a>, <strong>performance analysis</strong>, more commonly today known as <strong>profiling</strong>, is the investigation of a program&#8217;s behavior using information gathered as the program executes (i.e. it is a form of <a href="http://en.wikipedia.org/wiki/Dynamic_program_analysis" target="_blank">dynamic program analysis</a>, as opposed to <a href="http://en.wikipedia.org/wiki/Static_code_analysis" target="_blank">static code analysis</a>). The usual goal of performance analysis is to determine which sections of a program to <a href="http://en.wikipedia.org/wiki/Optimization_%28computer_science%29" target="_blank">optimize</a> &#8211; usually either to increase its speed or decrease its memory requirement (or sometimes both).</p></blockquote>
<p>As the quote says this technique is specifically aimed at the optimization of code; the tools enable the developer to quickly target the areas of code that need optimization and lead to an improved return for the effort. (seems strange saying ROI when talking about dev techniques, but this is really what it is).</p>
<h3>Getting started</h3>
<p>Red Gate provide a 14 day trial, so you can try before you buy.  The latest <a href="http://www.red-gate.com/Products/ants_profiler/index.htm">release</a>, version 4.3 as at the time of writing, has made some great improvements over the 4.1 version &#8211; most notably the removal of the need to stop all the IIS web sites listening on port 80 <img src='http://www.21apps.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>As you would expect this post will focus on profiling SharePoint code, I&#8217;m going to use the <a href="http://www.codeplex.com/sp8ball" target="_blank">Magic 8 ball</a> application developed for my <a href="/sharepoint/tdd-at-spbpc-slidedeck/" target="_blank">TDD session</a> at the Best Practices SharePoint Conference in San Diego.</p>
<blockquote><p>More details on Test Driven SharePoint development can be in the <a href="/agile/">Agile</a> section of this site.</p></blockquote>
<h4>Environment</h4>
<p>The environment that I will do the testing is a typical SharePoint developers Virtual Machine.</p>
<ol>
<li>Windows 2008 Server (32bit)</li>
<li>Visual Studio 2008</li>
<li>Microsoft Office SharePoint Server 2007</li>
<li>SQL Server 2005</li>
</ol>
<p>As this is running on Windows 2008 I will be testing against IIS7.   The requirements are identical for Windows 2003 and IIS 6.0</p>
<h4>Installation</h4>
<p>Download ANTS Profiler and install, not too many options to worry about here.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb6.png" border="0" alt="image" width="244" height="123" /></a></p>
<p>Luckily for my first run through the team have provided a technical paper on installing, using and getting ANTS Profiler to work with SharePoint, <a href="http://www.red-gate.com/support/Knowledgebase/ANTS_Profiler/AP4SharePoint.pdf" target="_blank">How to profile a SharePoint 2007 Site Collection</a>.  There were a few things in here that I prefer not to do,  I will document what I do below and will pass this back &#8211; I&#8217;m not criticizing, there&#8217;s no way I would even attempt to write a Profiler so mucho respect from me to the Red Gate team</p>
<h3>Configuration</h3>
<p>We are looking for the ability to profile any site collection within a Web Application.  This involves getting the account used for the associated application pool, giving it some additional rights and then configuring the ANTS services to use this account.</p>
<h4>Web Application</h4>
<p>Depending on your development machine configuration you will have a number of web applications configured in SharePoint, the configuration below should be reasonably familiar to most of you.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb7.png" border="0" alt="image" width="537" height="252" /></a></p>
<p>The key here is to identify the web application (IIS Website) as we need to get the account name from the associated Application Pool.</p>
<p>Load IIS Manager, select the web application and chose Basic Settings from the Actions menu on the right.  This will show the associated application pool as below.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb8.png" border="0" alt="image" width="715" height="492" /></a></p>
<p>Select the Application Pools from the connections menu, choose the application pool identified in the previous step and click advanced settings.  This will give you a properties screen showing the account we need to work with.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image9.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb9.png" border="0" alt="image" width="456" height="556" /></a></p>
<p>In this case <strong>21apps\svc-intranet-ap &#8211; </strong>if you have a local installation this may be set to Local System in which case the steps below may not be required.   I recommend that dev&#8217;s don&#8217;t have a default install as you really need to understand how SharePoint is setup to undertake any large scale developments.</p>
<h4>Web.Config</h4>
<p>In IIS 6 days you would need to edit the web.config file to set the application into debug mode.   In IIS 7 the common ASP.NET configuration options have been promoted to the IIS console.  With the web application still selected click on the .NET Compilation option and change the Debug behaviour to True and click Apply.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image10.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb10.png" border="0" alt="image" width="592" height="361" /></a></p>
<p>Like all good SharePoint developers you will be working with WSS_Minimal trust settings or a custom policy file.  To do profiling however you will need to set the Trust level to Full.  Again IIS 7 provides a UI or you can edit it manually.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb11.png" border="0" alt="image" width="501" height="242" /></a></p>
<p>It is possible to run the code without setting a Full trust level, but you need to remove the .pdb files and will lose the ability to profile the lines of code.  Which is sort of the point of profiling!  If you don&#8217;t set Full trust you will get an error like the one below when loading a web part</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: consolas,'Courier New',courier,monospace; max-height: 200px; font-size: 8pt; cursor: text;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;">Web Part Error: An error has occurred.

Show Error Details
Hide Error Details 

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
  at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandle&amp; ctor, Boolean&amp; bNeedSecurityCheck)
  at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
  at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
  at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
  at System.Activator.CreateInstance(Type type, Boolean nonPublic)
  at System.Activator.CreateInstance(Type type)
  at Microsoft.SharePoint.WebPartPages.SPWebPartSerializer.get_DefaultControl()
  at Microsoft.SharePoint.WebPartPages.BinaryWebPartSerializer.SerializedWebPart..ctor(SPWebPartManager webPartManager, XmlNamespaceManager xmlnsManager, Byte[] sharedData, Byte[] userData, String[] links, Type type, SPWeb spWeb)
  at Microsoft.SharePoint.WebPartPages.BinaryWebPartSerializer.Deserialize(SPWebPartManager webPartManager, XmlNamespaceManager xmlnsManager, Byte[] userData, Byte[] sharedData, String[] links, Type type, SPWeb spWeb)
  at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)

[VerificationException: Operation could destabilize the runtime.]</pre>
</div>
<h4>Services</h4>
<p>ANTS runs as two services</p>
<ol>
<li>ANTS Memory Profiler 4 Service</li>
<li>ANTS Performance Profiler 4 Service</li>
</ol>
<p>Change the accounts on these two services to the same accounts used in the web application we identified above.</p>
<p>If this is the first time the account has been associated with a service it will be automatically granted the &#8216;Log On As A Service&#8217; right.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb12.png" border="0" alt="image" width="487" height="464" /></a></p>
<h4>Local Security Policy</h4>
<p>From the Administrators menu choose Local Security Policy and grant the application pool account the following rights</p>
<ol>
<li>Act as Part of the Operating System</li>
<li>Impersonate Client after authentication</li>
</ol>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb13.png" border="0" alt="image" width="589" height="399" /></a></p>
<p>Open a command prompt and run gpupdate /force.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image14.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb14.png" border="0" alt="image" width="459" height="111" /></a></p>
<h3>Profiling your code</h3>
<p>Your environment is now configured, we can start profiling.  As this is SharePoint I tend to just hit the bit i&#8217;m planning to profile first to make sure this is working before I start profiling.  Many hours can be lost trying to solve a configuration issue with a profiler that is not at fault.</p>
<p>Start Red Gate ANTS Performance Profiler.  It knows we&#8217;re running on a system a system that has UAC, it offers to make our life easy and always run as an Administrator.  I normally click yes here.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image15.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb15.png" border="0" alt="image" width="423" height="300" /></a></p>
<p>ANTS loads the Profile Settings window is automatically.</p>
<p>There are only a few things to set.</p>
<ol>
<li>Choose the ASP.Net web application (hosted in IIS)</li>
<li>The URL to the SharePoint site</li>
<li>Use the original port</li>
</ol>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image16.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb16.png" border="0" alt="image" width="687" height="530" /></a></p>
<p>Further profiling counters can be set, but we just want to get our first run going for now.  Click on Start Profiling.  (In this example I have added a long running process to show how ANTS can identify this as a hotspot).</p>
<h3>Profile Results</h3>
<p>Profiling will start and a new browser will open at the location specified.  As this is SharePoint the profiler restarts the service so you will always have a small delay while SharePoint is JIT compiled. The profile timeline will show this impact on the processor.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image17.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb17.png" border="0" alt="image" width="783" height="198" /></a></p>
<p>Once the processor has levelled out its time to start profiling your code.   Navigate and interact with the bit of the application you are interested in.  If it is a  web part or navigation load you are interested in then you can refresh the page.</p>
<p>Once you are happy you have performed enough tasks,  I recommend keeping these focused, stop the profiling. ANTS will present you with the HOT code, the bit of code that is the worst performing. You can focus the analysis on any part of the profile graph to show poor performing code around a specific spike in the processor or memory.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image18.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb18.png" border="0" alt="image" width="779" height="594" /></a></p>
<p>In the example above I am focused on the code that runs (including my long running process) when I ask the magic 8 ball a question.</p>
<p>Viewing source code when you have enabled Line level profiling shows every line, the hit count and the % of time taken to perform that operation.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image19.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb19.png" border="0" alt="image" width="818" height="549" /></a></p>
<p>The really cool thing is you can click through the methods to follow the slow running process through the code!</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image20.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb20.png" border="0" alt="image" width="547" height="143" /></a></p>
<p>Showing the method grid allows you to open up a call graph for any method to see how the processing is broken down in a dynamic tree view.  This really is just brilliant!  The image below does not do it justice you really do need to see this for yourself to appreciate it.</p>
<p><a href="http://www.21apps.com/wp-content/uploads/2009/02/image21.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.21apps.com/wp-content/uploads/2009/02/image-thumb21.png" border="0" alt="image" width="420" height="397" /></a></p>
<h3>Conclusion</h3>
<p>The long running process I added for the demonstration was picked up and allowed me to drill down into the lines of code that were the slowest.  It even showed how the internal calls within the base classes performed.</p>
<p>Red Gate ANTS Profiler is easy to setup and proves to be an invaluable tool in your software development tool kit.  I suspect profiling will not be something that you do every day, however with the speed and ease of use I would like to think that you will consider the inclusion of profiling a must have rather than a nice to have.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.21apps.com/sharepoint/code-profiling-ants/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

