But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

Is Pex and Moles the answer to Sharepoint testing?

I have got round to watching Peli de Halleux’s presentation on testing SharePoint with moles from the SharePoint Connections 2010 event in Amsterdam, very interesting. This brings a whole new set of tools to the testing of Sharepoint. I think it is best to view the subject of this presentation in two parts Pex and Moles, even though they are from the same stable; Moles being produced to enable Pex. But rather than me explaining how it all works just watch the video.

So to my thoughts, the easier bit to consider is Pex. If you can express your unit tests in a parameterised manner then this is a great tool for you. The example that Peli gives of an event handler that parses a string is a good one. We all have loads of places where this type of testing is needed, especially in Sharepoint. The problem here, as he points out, is that you need to use some form of mocking framework to allow the easy execution of these tests for both developers and automated build servers. I would usually use Typemock Isolator to provide this mocking, the problem is that Pex and Isolator at this time can’t run together. The Pex Explorer does not start the Typemock mocking interceptor, and thus far I can’t find a way to get round the problem.

So enters Moles, this is Microsoft Research’s subbing framework that ‘detour any .NET method to user-defined delegates, e.g., replace any call to the SharePoint Object Model by a user-defined delegate’. Now I find the Moles syntax is a bit strange. I suspect it is down to my past experience, but I still find the Typemock Isolator AAA syntax easier to read than Moles’. However, there are some nice wrapper classes provided to make it easier to use the Moles framework with Sharepoint.

So where does this leave us? At this time if you want to use Pex (and I certainly would like to) you have to use Moles (if you need stubbing). But you also have to remember that Pex & Moles are research projects. They are available for commercial evaluation, but at this time there seems to be no plans to productise it or roll it into Visual Studio, this means on effect no support. I don’t see either of these points as being a major barrier, as long as you make the choice to accept them knowingly.

However for ultimate flexibility it would be really nice to see Typemock Isolator being interoperable Pex, thus allowing me to use the new techniques of Pex against legacy tests already written using Isolator.

At last, my creature it lives……..

I have at last worked all the way through setting up my portable end to end demo of  testing using Windows Test and Lab Manager. The last error I had to resolve was the tests not running in the lab environment (though working locally on the development PC). My the Lab Workflow build was recorded as a partial success i.e. it built, it deployed but all the tests failed.

I have not found a way to see the detail of why the tests failed in VS2010 Build Explorer. However, if you:

  1. Go into MTLM,
  2. Pick Testing Center
  3. Select the Test Tab
  4. Pick the Analyze Test Results link
  5. Pick the test run you want view
  6. The last item in the summary is the error message , as you can see in my case it was that the whole run failed not any of the individual tests themselves

image

So my error was “Build directory of the test run is not specified or does not exist”. This was caused because the Test Controller (for me running as Network Service) could not see the contents of the drop directory. The drop directory is where the test automation assemblies are published as part of the build. Once I gave Network Service read rights to access the \\TFS2010\Drops share my tests, and hence my build, ran to completion.

It has been a interesting journey to get this system up and running. MTLM when you initially look at it is very daunting, you have to get a lot of ducks in a row and there are many pitfalls on the way. If any part fails then nothing works, it feels like a bit of a house of cards. However if you work though it step by step I think you will come to see that the underlying architecture of how it hangs together is not as hard to understand as it initially seems. It is complex and has to be done right, but you can at least see why things need to be done. Much of this perceived complexity for me a developer is that I had to setup a number of ITPro products I am just not that familiar with such as SCOM and Hyper-V Manager. Maybe the answer is to make your evaluation of this product a joint Dev/ITPro project so you both learn.

I would say that getting the first build going (and hence the underlying infrastructure) seems to be the worst part. I feel that now I have a platform I understand reasonably, that producing different builds will not be too bad. I suspect the next raft of complexity will appear when I need a radically different test VM (or worse still a networks of VMs) to deploy and test against.

So my recommendation to anyone who is interest in this product is to get your hands dirty, you are not going to understand it by reading or watching videos, you need to build one. So find some hardware, lots of hardware!

The uptake of Agile and Alt.Net practices in places a bit away from the major development hotspots

Last week I got into an interesting discussion via email with Nieve a developer from Lille, France.The chat was on the uptake of Agile and Alt.Net practices in places a bit away from the major development hotspots. We both thought it could make an interesting post so, here goes, starting with Nieve’s first post…..

Hello there,I've stumbled upon your blog while googling for the terms alt.net yorkshire.I'm a .NET developer working in Paris and living in the north of France (Lille area). Now, the reason I'm writing is that we're having an alt.net lunch next month, and I would like to talk a bit about the differences between the (alt).net communities in france and england. Now since I did my studies in Leeds, the fact that yorkshire and la région du nord are (surprise surprise) in the north (plus a shared history of mines) brought me to google for alt.net and yorkshire.Over here in Lille/the north of France the situation is rather grim. job offers that entail agile practices and or tools in .NET environment are as rare as an eclipse, managers and developers alike are literally afraid of any framework/tool that isn't microsoft yet somehow miraculously written in a .net language. I suppose you get the picture. I was wondering if you would mind sharing with me (and/or others, on your blog) your thoughts on the situation in yorkshire.

My reply

I don't know if you have heard of Ian Cooper, he was one of the organisers of the ALT.NET events in the UK. Well he just posted on his blog on a subject very close to your question http://codebetter.com/blogs/ian_cooper/archive/2010/01/19/whither-alt-net.aspx

In my opinion there has not been a drop of in interest over the tools and practices of ALT.NET but it has lost it’s label a bit. Ian is right the main people pushing it have moved more towards Twitter etc. which has reduced visibility if you don't follow them.

Local groups are still on the go. I myself attend Agile Yorkshire http://www.agileyorkshire.org/ which is a group driven by development process (being JAVA and .NET) but did help organise the ALT.NET in the North event last year. We hope to run something this year, but we doubt it will be under the ALT.NET banner as it was felt this alienated JAVA members

As to who is using the tools, no as many as I would hope. But you find them in surprising places. I found out that a dev teams in the NHS (usually known to be very bureaucratic and fixed management process) are using Kanban, nHibernate etc. and finding them useful. Getting adoption is all down to someone showing there is an advantage, the problem is so few people in our industry care about improving their skills, it all comes back as Ian said to the software craftsmanship movement

Nieve again

First of all let me begin by saying I only wish I could tell you how much I am thankful. Reading Ian's post was a something of an epiphany moment :) At some points he brought it so close to home that I had to stop and think 'hold on, is he just talking about software development or is there a hidden message about the state of France..?' Over here it's not only the IT industry that breeds this sort of position holders that are fine where they are and just won't bother changing anything. I always think of it as 'with all that revolution going on, you don't get any evolution'; the idea is that everyone here are jumping to their feet and straight to the street to cry against whatever change that is offered, that nothing ever gets to change hence no evolution...

To get back to the issue in question, I think one of the things Ian, and for that matter many of the ALT.NET people, tend to forget or simply overlook is the fact that while at some parts of the world people may think the battle was won, or that it's about time to wake up from our comfortable twitter hibernation, in some other parts the battle hasn't even began, which brings me back to my original question. See, you guys up the in England and esp. in the north can be very proud of your community, and not only the alt.net/agile/software development/IT one, but also the local-geographical community. I had to go and look for a job in Paris, which entails a couple of hours on the train each and every day and which is bound to end by leaving Lille (and no wonder I'm considering moving back to yorkshire); Not only developers and managers are afraid of anything that is not microsoft, the actual idea of software craftsmanship is an abnormality in our region. There is a Nord-agile group that works here and have meetings every couple of months and consists of 5 to 7 people, none of them a .net person. And we're talking about a huge region and one of france's 5 biggest cities.

With that in mind, there's also the fact that roughly each and every year a new generation of developers is arriving to the market which makes it even more difficult to those (esp the beginners to senior-juniors) who wants to learn and work on their coding craftsmanship. (I remember I discovered the alt.net manifest only a couple of years ago or so, and soon after I remember reading a post of Ayende saying he's going to give Twitter a shot. Thank god, he's one of those who never stopped blogging.)

As for Paris, things seem to be closer to what Ian said; there are a lot more job offers that ask for a working experience in NH, MVC, NUnit etc', however this feels like the new orthodoxy.

… and me again

So to me this shows that the problem we both see are not just down to us at our company/technology/region/country. Craftsman Developers everywhere tend to sit in small isolated pockets, even in large conurbations, and there is nothing to go but to organise locally where you can, go on go for a beer you know you want to, and to join in the virtual communities to get a bigger world view.

Wow, that sounds like a call to revolution, better go into hiding in case the thought people come round, I know I will just have to think I am not in!

Why don’t I love my phone?

There seams to be loads of coverage at present over mobile platforms. Maybe I am just noticing it due to coverage of the CES show and the launch of the Nexus One, but the more mainstream media does seems to be taking a good deal of interest in the future of smartphones (or superphone as Google are calling their new one).

All the articles seems to Apple Vs. Android (and moving rapidly towards Apple Vs. Google). There is also usually a passing mention of Blackberry, then a ‘wonder where Nokia are?’ but usually very little on Microsoft. The article in this months UK edition of Wired is a classic example.

As a reasonably happy Windows Mobile 6.5 user (I have an HTC Diamond 2) I find this all very interesting. My phone works most of the time, does most of what I need and certainly does not need to be rebooted as much previous smartphones I have had. However, I have to say, it does not engender me with the missionary zeal iPhone (and I suspect future Nexus One) user have. They all seem to have a pure pleasure in the ownership and use of their device. My phone is a bit of kit that does the job most of time, I don’t love it or hate, it is what it is.

I do wonder if I moved to an iPhone would I be the convert so many others seem to be; or is it just my nature to not be such a devotee of any phone/car/coffee machines etc. or in fact objects and brands in general?

This all said, it is very noticeable that the Microsoft mobile platform (and actually the supporting eco-system e.g. the iPhone App Store) is lagging behind, the silence of Windows Mobile 7 just seems to drag on and on. Whatever comes out is going to have to make a big leap to catch up (let alone overtake) other vendors offerings.

Anyway whilst I was writing this post I see that Robert Scoble has posted probably a more consider review of the current state of the mobile space. Great minds think a like?

My Christmas Message to the world

Like the Queen, I have recorded a Christmas message this year. Now I have no prior knowledge of what her Majesty will speak about this year, but I will lay good odds it is not about using Typemock Isolator.

On the Typemock site you will find a short video on how we at Black Marble make use of Isolator to tackle testing problems that do no lean themselves to traditional mocking patterns.

So if you are at a loose end over the holidays why not curl up with your loved ones and partake in this festive IT video.

PDC Keynote Day 1 thoughts

So the PDC2009 day 1 keynote is over and what was the story? Well it is more of a vision thing, but then again this is a PDC not a TechEd so what do you expect. For me the two major themes were

  • Dallas – a centralised data service that allows unified access to both public and private via subscriptions. Thus allowing core data being used for any purpose the user requires within the EULA of the data in question. It will be interesting what will be published in this manner, is there a market for a centralised data clearing house? only time will tell.
  • AppFabric – Basically taking the operating model for the Azure services and allow a company to have a similar model in their own IT system. Thus allowing code to be written that can work on the corporate system or Azure cloud without alteration. This I see as being big.,

So what was not mentioned, well it was mobile. The only comment was a ‘come to Mix in the spring for stuff about the next mobile offering. Whatever is shown there is going to have to very good to address the momentum of the iPhone. I think a good bet is that leveraging the Azure fabric might be important for the mobile offering

Access Services in SharePoint 2010 or: How I Learned to Stop Worrying and Love Access 2010

So what I have I been doing of late? The blog has been a bit quiet. Well I have been having a good look at Access Services in SharePoint 2010. This has been an interesting experience, as I am not historically what you might call an avid Access developer.

Like most .NET developers I had looked as Access as more of a file format than an application, something from the past. Something that I might use for a small data store, maybe in a web application hosted on a cheaper ISP that does not provide ‘a real’ SQL DB, or where an XML data files don’t seem right, often because I just can’t be bothered to work out the XPATH. When using Access as a data format it seems easier to get at my data using basic hand crafted SQL commands or maybe at most via a OLEDB Data Adaptor/DataSet. All very old old school. Thinking about Access in this way just seems an easy way out, playing it safe with the knowledge I have. I don’t for a second propose that this a good idea, you should not be looking at using any technology just because it is there and you already know it. There are obvious downsides, using Access in this manner meant that from the ADO.NET developer side I could not:

But equally, by treating Access as just a data format I was not able to make use of it as the Rapid Development tool it is. I was too hung up in the unpleasant idea of an MDB sitting of a server being poor at locking and saturating the network with unwanted traffic. I was not even considering Access as a front end to a MS-SQL solution, and it is not as if that is new technology, it has been around for ages. I was just sitting happily with my prejudices.

I don’t think this position is that rare for .NET developers these days. Access seems just looked down upon as something old in the Office pack that is best ignored, no good would come of using it in a business environment.

So enters Office 2010 and SharePoint 2010 Access Services, for me this changes the game. For those who don’t know this technology, you can create an Access database locally on your PC then publish it to SharePoint. Tables become SharePoint lists, macros become workflows and forms well become forms. Access becomes a RAD tool to create data driven SharePoint sites.

So how has this new technology been working for me? Well I can’t say I have grown to love the Access client, but I think that is mostly down to that fact that I am still not thinking right for it. Access is all about data binding, you don’t have to think about what form fields need to be copied to which DB columns, the wizards make a really good attempt to design forms for you based on the relationship of the tables in your DB and this just all seem unnatural to me. I think this is because I am usually working with design patterns to reduces the linkage between forms and data to a minimum e.g. the MVC pattern, and so consider this good practice; automated data binding seems seems wrong. So in Access I keep wanting to build things from first principles, but this is just not sensible. Better to let the tool get you close and then you add the polish, put away any thoughts of implementing design patterns as you would in a language such as C# or VB.NET.

I think this is the key to the degree of irritation I feel with the product, if you have got used to architecting from the ground up, especially in a Test Driven Development style, you have to turn everything on it head. It feels like you are cheating, not doing the job properly.

But wait! look at the benefits. A while ago I was involved in a project to provide a resource management data driven web site that was hosted within SharePoint. It contained the usual things, data entry forms, links to SQL and reports. It took a couple of weeks to build. I think I could write the same system in Access with SharePoint 2010 in an afternoon, and would be happy to have a client’s business analyst sit next to me while I did it, in a pair programming style, to design the forms, report layouts and columns as I went along. For the smaller scale data driven site Access Services is a great tool, but obviously it is not perfect. I do keep hitting points where I think ‘if I were in C# I could just do that’ but then I remember ‘yes but it would take would have taken me three days to get here not an hour’. Most project don’t need that last 10-20% you can only reach on .NET custom code, the client with be far happier with 80% done quickly and flexibly rather than 95% done a lot later. Also we have to factor in my relative lack of experience with Access as a RAD tool, reducing the productivity that could potentially be achieved by a more experienced Access developer.

Actually the bulk of the time I have spent has been on looking at how you can extend Access Service to reach that last 20% of functionality, and it not that hard. The key to remember is that the Access Services are just built on standard SharePoint objects. Ok there is a new service running to render the pages, but underneath there are just SharePoint lists and workflow, and where these exist there are events that you can programmatically handle. I have found that by trapping events such as ItemAdd() for the Access created SharePoint lists there is no real limit to what you can achieve via the SharePoint Object Model. And this development process is made even easier by the new Visual Studio 2010 templates for SharePoint features. If nothing else the fact that all the templates create a WSP for deployment as standard makes for far more robust feature development.

There is one major difference between a standard SharePoint site and one created by Access, and it is that SharePoint Designer cannot open the Access site. I thought this would be an issue when I first heard about the limitation, but it turn out not to be. Anything you might have wanted to do in SharePoint Designer you can do quicker and easier in Access for this type of data driven site. Ok the range of things you can do is more limited, but again you get that 80% you need with much less pain.

So how has my experience with Access 2010 been? Exasperating, frustrating but undeniably productive. I am not sure it is the right product for an ISV style company who want to roll out single solution to many client sites (but it could be used for this if needed via the SharePoint site template gallery); but for a smaller data driven site (with or without custom extensions) written within an IT department it is a very strong contender. Taking Access in many ways back to it roots.

So if you need small data driven sites I would suggest you put aside your prejudices and have a look at the beta program for Office/SharePoint 2010, I think you will be surprised.

Your support can keep our industry's history alive

We had a company outing at the weekend to Bletchley Park for their Annual Enigma Reunion event. A great chance to see the place where Enigma was cracked and some of the equipment they used to do it, such as the working  rebuild of a Turing Bombe

Turing Bombe rebuild

Whilst down there we also took the chance to have a good look around the National Museum of Computing, which shares the site; you know are are getting old when a third of a museum is devoted to equipment you have worked on!

Black Marble at the Mueseum of Computing by Colosus

I would urge anyone interested in the history of our industry to take the time to drop by Bletchley Park to have a look at both the museums on the site. And if you can, donate to aid their upkeep as neither Bletchley or the Computing Museum get any governmental support. Think of them live steam preservation societies, full of keen volunteers, with loads of ideas and partially working equipment that just need a bit of money to save a history the UK led the world in.