Thursday, March 05, 2009

SharePoint unit testing

Update 8/3/2009: I updated some statements to avoid misunderstandings ...

As the kind of solutions we built on SharePoint become increasingly more complex it might be an interesting idea to take a look at creating unit tests for your solutions (although some people might tell you that it is not always worth the effort - see Peter Seale - SharePoint: not unit testing ). There are some challenges when trying to create unit tests for SharePoint development  as outlined in Unit Testing SharePoint 2007 Applications.  An interesting approach is using Isolator for SharePoint which allows unit testing sharepoint code without needing SharePoint installed (You would typically run your unit tests on your build server so this is quite handy). If you look at  the SharePoint Guidance of the Patterns&Practices group you will notice that they are using the same approach.

A good resource to get you started is the great series of whitepapers about unit testing and SharePoint written by Andrew Woodward:

Related resources:


Jeremy Thake said...

The also has coverage on Unit Testing in SharePoint.

Currently it covers an overview of how to configure an existing project with unit testing.

Shortly I'll be adding some extra bits on scenarios where it makes sense to unit test and those that it doesn't as I think there's a lot of confusion on that.

Check out it out here

sharepoint said...

Another place with good resources for unit testing SharePoint is