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:
- Unit Testing SharePoint Solutions - The basics (White paper - Andrew Woodward) and the codesamples which go along
- Unit Testing SharePoint Solutions - Getting into the object model (White paper - Andrew Woodward) and the codesamples which go along
- Shared Points for SharePoint - Unit testing SharePoint code
- Shared Points for SharePoint - Unit testing MOSS part 1 (of 2)
- Shared Points for SharePoint - Unit testing MOSS part 2 (of 2)
- SPTDD: SharePoint and Test Driven Development Part One
- More thoughts on Test Driven Development with SharePoint 2007