Beginners Guide to Test Driven Web Part Development

Unit Testing SharePoint Solutions – The Basics


Beginners Guide To Test Driven Web Part Development

This white paper is based on our views and experience, we welcome your comments and suggestions and will update the white paper as the knowledge, experience and best practice evolves.

The code to support this white paper.

Bookmark the permalink.
  • Peter Seale

    I liked the article, it was very approachable and no-nonsense introduction to testing web parts and doing TDD.

    I maintain my opinion that attempting to do full unit test coverage doesn’t help enough to be worthwhile, at least in my projects. I’ll happily write tests for the parts that can be easily tested (i.e. code that doesn’t interact with the SharePoint object model), but the majority of my code does in fact, interact with the SharePoint object model–so in effect, I don’t end up unit testing anything.

    Tom Clarkson wrote a few interesting posts on his blog, you may be particularly interested in his approach to testing Workflow:

  • Pingback: Beginners Guide to TD WebPart Development - Crossposting from (SharePoint)

  • Mark Mascolino

    Interesting. I do however look forward to articles that actually use the SharePoint OM. Also key I think is to make sure that everything is automated and configurable so that developers working on different machines with different configurations can still do their work on the same code base without troubles.

  • Andrew Woodward


    I agree that there is a need for some examples using the OM and these are in progress. What I wanted to do with this first white paper was introduce to concept to people and show that it is possible to to TDD in SharePoint projects. Introduction Mocking in a beginners guide I think would scare people away from the subject completely.

    This blog post does provide some links that start to demonstrate unit testing where you code uses the SharePoint OM.

  • Pingback: WSS 3.0 & MOSS: Recopilatorio de enlaces interesantes (XXI)! - Blog del CIIN

  • Pingback: WSS 3.0 & MOSS: Recopilatorio de enlaces interesantes (XXI)! « Pasión por la tecnología…

  • Erik Burger

    Hi Andrew,

    Very nice article and an excellent introduction to TDD within a SharePoint environment. I realize that there’s a lot of issues involved when one starts using the OM so I am looking forward very much to the next installment.

    Best Regards,

  • Allgates

    Its really good. I didn't read full data..I will comment again my opinion about this soon..Keep doing this job..
    home school

  • williyamb

    Ecommerce Web Design Ecommerce Web Design

  • williyamb

    website design service website design service

  • Pingback: Links 2009-05-15 - Gunnar Peipman's ASP.NET blog

  • Craigslist Proxy

    Some good points raised in that post. Will be back to check for more.

  • Mark Smith

    Many thanks. I've downloaded this but not yet read it. The text formatting is weird – like the whole document is a btimap, BTW.

  • Craigslist Proxy

    Interesting post. I have made a twitter post about this. Others no doubt will like it like I did.

  • Pingback: WSS 3.0 & MOSS: ALM en SharePoint (I)! - Blog del CIIN

  • Pingback: WSS 3.0 & MOSS: ALM en SharePoint (I)! « Pasión por la tecnología…

  • Dalaman Transfers

    thank you for this article..

  • graceglmcooke

    Numbers are small compared to, say, breast cancer or adult cancer victims; if kids survive that aggressive chemo, radiation and bone marrow transplants, the problems they have in their 20s as a result of that radiation exposure and levels of toxic drugs at such a young age, can produce infertility, skin cancer and other developments when they become adults. Please consider CURE Childhood Cancer when determining what hrsaccount non-profit needs your support. Our kids deserve nothing less.

  • Traveller_Adventure

    Great post, really help me alot. Thanks.

    Buat Duit Dengan Blog

  • Jim Adcock

    Two things –

    First, I agree with Mark that the formatting of the doc is weird. Most annoying is that the hyperlinks aren't clickable, especially the ones without URLs (ex the unit testing articles referenced on the bottom of page 3.

    Second, the comments from Allgates and Traveller_Adventure have a bit of a spammy feel to them (though without my having visited their links). Just saying…

  • AndrewWoody

    Thanks Jim, have now removed what were rightly spam comments that got through the net.

    I think the PDF being a bit off was down to the way it was generated, will see if the new Office 2007 PDF export works better.

  • kurtcbn

    I already download it, will learn it first. Cheers
    Cell Phone PDA Blog

  • backlinks

    nice post, thanks for sharing

  • backlinks

    nice post, thanks for sharing

  • bazphone

    This seems like the most comprehensive blog on this niche


  • Ali Danger

    From what I can see this is a tutorial on (a) writing a generic unit test; and (b) writing a web part, but does not cover writing a unit test for a web part. Quite helpful, but didn't really solve my problem.

  • AndrewWoody


    have a look at the second White paper. This one really shows how you an design testable code even with SharePoint.

    If you have any specific challenges let me know.

  • Lars Nielsen

    Thanks for this paper. As someone who knows only a little about unit testing, this is a great starting point on the practicalities of unit testing.

    It was a good idea to focus on unit testing a class at first, rather than getting bogged down in the SharePoint object model and the web part itself. I found when going through the tutorial that I occasionally got “Unable to copy” compiler errors in Visual Studio when the DLL was locked by NUnit. The solution was to reload the project in NUnit before compiling – it might be worth mentioning this in the notes.

  • Get Ex Back

    well, Solutions—The Basics. Andrew Woodward explains the fundamentals of writing unit tests for SharePoint solutions

  • Pingback: » Beginners Guide to TD WebPart Development (none)