April 2010 - Posts

Busy week, off to see Typemock in Oslo
Sun, Apr 25 2010 14:47

I am off to Oslo, for the first time, for the Typemock Academy this week. The event has managed to survive the disruption of the Icelandic volcano.

A great chance to meet a pile of people I have only spoken toon the phone or via email in the past. Looking forward to it.

Mocking Sharepoint for Testing
Thu, Apr 22 2010 5:47

In my previous post I talked about using Isolator to mock Sharepoint to aid the speed of the development process. I find this a productive way of working, but it does not really help in the realm of automated testing. You need a way to programmatically explore a webpart, preferably outside of SharePoint to check its correctness.

You could use the methods in my previous post and some form of automated web test, but this does mean you need to spin up a web server of some descriptions (IIS, Cassini etc. and deploy to it) An alternative is look at the Typmock addin Ivonna. This a creates a fake web server to load you page and tools to explore it.

I will describe how to use this technique using the same example as my previous post.

Previously I had placed all the code to fake out SharePoint in the Page_Load event of the test harness page. As I am now trying to write an unit/integration test I think it better to move this into the test itself so I would delete code I placed in the Page_Load event other than any property settings on the actual webpart. I would actually refactor the lines creating the fake URL context and fake SPSite into some helper methods and then call them from my new test. I would then load the page in Ivonna and check it’s values.

I have tried to show this below, using a couple of techniques to show how to get to components in the page.

   1: [TestMethod, Isolated]
   2:      public void LoadWebPage_SpSimpleWebPart_3EntriesInList()
   3:      {
   4:          // Arrange
   5:          TestHelpers.CreateFakeSPSite();
   6:          TestHelpers.CreateFakeURL();
   7:  
   8:          TestSession session = new TestSession(); //Start each test with this
   9:          WebRequest request = new WebRequest("/SpSimpleTest.aspx"); //Create a WebRequest object
  10:          
  11:          // Act
  12:          WebResponse response = session.ProcessRequest(request); //Process the request
  13:  
  14:          // Assert
  15:          //Check the page loaded
  16:          Assert.IsNotNull(response.Page);
  17:          
  18:          // the the Ivonna extension method to find the control
  19:          var wp = response.Page.FindRecursive<DemoWebParts.SpSimpleWebPart>("wp1");
  20:          Assert.IsNotNull(wp);
  21:  
  22:          // so we have to use the following structure and dig knowing the format
  23:          // webpart/table/row/cell/control
  24:          var label = ((TableRow)wp.Controls[0].Controls[0]).Cells[1].Controls[0] as Label;
  25:          Assert.IsNotNull(label);
  26:          Assert.AreEqual("http://mockedsite.com",label.Text);
  27:  
  28:          var list = ((TableRow)wp.Controls[0].Controls[1]).Cells[1].Controls[0] as DropDownList;
  29:          Assert.IsNotNull(list);
  30:          Assert.AreEqual(3, list.Items.Count);
  31:      }

Now I have to say I had high hopes for this technique, but it has not been as useful as I would hope. I suspect that this is due to the rapid changing of the UI design of client’s webparts making these tests too brittle. We have found the ‘mark 1 eyeball’ more appropriate in many cases, as is so often true for UI testing.

However, I do see this as being a great option for smoke testing in long running projects with fairly stable designs.

Post SharePoint Evolution thoughts
Wed, Apr 21 2010 11:01

I am on the way home from my whistle stop visit to the SharePoint Evolution conference. I must say congratulations to the organisers for putting on such a successful event given all the problems they have had related to speakers and air travel, well done.

My slides, on Testing Webparts with Typemock, will appear on the conference site soon, but I thought it a good idea to link here to previous posts I have done on the subject. Imaging how surprised I was to realise to find I never wrote them! If you search my blog you will find links to older versions of today's slide stack, but no coding samples.

So I will do a couple of posts as quick as I can that go through the demos I did today, so expect one on ‘Mocking Sharepoint for Design’ and another for ‘Mocking Sharepoint for Tests’

Speaking at Developer Day South West
Fri, Apr 16 2010 9:03

I have just heard I will be speaking at Developer Day South West on June the 5th. My subject is Using the new Developer and Test features of VS 2010 to track down and fix bugs, this is basically the same session as I have at our TechDays fringe event yesterday.

Hope to see you there

DDDSouthWest2BadgeSmall[1]

Todays #UKTechDays Leeds Fringe event
Thu, Apr 15 2010 8:28

Thanks to everyone who turned up for Matt Nunn’s and my sessions in Leeds today. All seemed to go well and were well received.

As my slide stack consisted of a a welcome screen and an agenda I don’t really see the point of posting them on web. If you want to see the end to end story of VS2010 ALM I would suggest looking at the video’s on Channel 9.

Video of MVP at Microsoft Techdays events
Thu, Apr 15 2010 8:19

Whist at the the UK Techdays I did a video with Rob Miles. You an see the results here, we are near the end.

A full video of my session should be available on the Microsoft UK Techdays site soon

by But it works on my PC!
Filed under: ,
Useful tool to move Reporting Services reports between servers
Wed, Apr 14 2010 8:44

When you are moving TFS contents around between servers, as many people will be doing as they implement new 2010 servers and want to make use of Team Project Collections; you often have to move Reporting Services reports. In many cases you find people have lost their customised .RDL files they uploaded in the first place, and don’t want to restore the whole Reporting Services DB.

So how to extract an RDL file from a Reporting Services instance and moving it to a new Reporting Services instance?

Well have a look at Reporting Services Scripter, make makes the process fairly straight forward.

Speaking at the Typemock Academy in Olso in a couple of weeks
Wed, Apr 14 2010 6:54

I am really pleased to say I will be speaking at the first Typemock Partner Academy in Olso the week after next. I will be taking about using how we at Black Marble have used Isolator to improve the speed and quality of our SharePoint development.

Follow up on my TechDays Lab Management session about the cost.
Tue, Apr 13 2010 15:09

I have seen a few tweets after my Techdays session on Lab Management that it sounded expensive. It is true that Lab Management is an extra license to purchase over and above Visual Studio. However under the new licensing model for VS you have to remember that as an MSDN subscriber you are already licensed for a TFS CAL and Server and if you have VS2010 Ultimate you are licensed for the Test Professional tools. With this collection of tools you can do much of the bits I showed in my session:

  • You can have a build server that runs MSTest (or nUnit) tests
  • You can create Gated Check Ins
  • You can use the new WF based build process (which you can extend yourself) that can include deployment to test boxes

Personally I think you can do this far easier than with a CC.NET/NAnt/SVN CI stack. That is not to say this stack is not really powerfully, but that you need to make more on a learning/time investment to get theses separate tools running together.

As I said in my session I think the key advantage of VS/TFS is the end to end ALM story, you can track and report on everything. The various components might not do everything its competitors do, but in my opinion they are in this release very close in functionality.

As to Lab Manager, as soon as you look at any comprehensive test environment, virtual or not, there are going to be costs. Irrespective of how you build it you are going to need tin and operating system licenses. It is not a going to be a cheap option, but any serious test lab strategy will need some investment and I think the Lab Management license itself will not be the major part of the cost.  

Goodbye Team System hello Visual Studio ALM
Tue, Apr 13 2010 3:44

Now that VS2010 has launched the branding of ‘Team System’ has gone; so I am no longer a MVP (Team System) but a MVP (Visual Studio ALM).

by But it works on my PC!
Filed under: , ,
Down in London for TechDays
Mon, Apr 12 2010 12:42

I am down in London for the first two days of the Microsoft TechDays event. First day has been very interesting, there seems to be a good buzz over the new testing features. So it looks good for my session tomorrow when I will be presenting on Lab Manager hope to see you there.

Post AIC 2010 Thoughts
Thu, Apr 1 2010 12:52

I was at the AIC 2010 conference yesterday, which I enjoyed more than last year. The most interesting session was Ivar Jacobson. He discussed how immature our industry is, with its disjoint between software engineers and academic computer scientists. Something I have commented on before when discussing if our industry should be licensed.

He discussed how we need to build our industry upon commonly agreed kernel of simple best practice activities, not upon some currently fashionable process whether it be Waterfall, CMMI, Agile, Lean etc. We must identify what are the best practices from all process (and all processes have something to offer) and teach them to students at University as this kernel of activities, as well as teaching how to compose them into more complex practices and hence whole development processes. Thus providing new entries to our industry with the base of reusable techniques that the can use for their whole career, irrespective of fashion. The key idea being that any current process model can be build by composing these kernel of basic activity.

So if this sounds interesting, and it does to me, have a look at www.semat.org. The signatories aim to have results within the year, if they achieve this aims this could well be the first step to making Software Engineering on a par with other chartered engineering disciplines such as Structural or Mechanical Engineering, with there is a long term set of industry accepted best practices that people can be judged against.