I've read the articles from Andrew Woodward (21Apps) trying to get started with unit testing on WSS, but when I try something more advanced, like Webpart connections, I don't know how to start testing them.

Anyone has experience on this?

Where can one find advanced resources for Unit Testing on WSS/MOSS?

  • I've made this a Community Wiki since unit testing in SharePoint is such a hot potato!
    – SPDoctor
    Nov 27, 2011 at 16:45

3 Answers 3



What is the specfic thing you are looking to unit test? Do you have some specific logic that you want to test for example - you have logic that does different things depending on the passed type of object.

Or are you looking to make sure the Web Parts are connected?

If it is the first then you really don't need to be concerned about how the method is called (i.e. from the web part manager/framework) you just want to test the scenarios work as expected.

If it is the latter then this is really testing SharePoint and I would not Unit Test this specifically, if you want some automation you may want to look at screen recording type options - but again may be just something you can get your Testers to validate.

  • Andrew, you are right!, the problem was that I missed the point of the unit tests, and starting doing integration testing.... Now that I revise those tests I know that I should not focus on the interactions, but on the internals of the component. Nov 3, 2011 at 16:23

The PnP Guidance Library has some discussion of implementing various types of testing for SharePoint solutions.

In short, it's not as easy as it should be...


You could test it with a web testing tool, for example watir vs selenium.

In this case you are just testing that the web pages work as expected.

  • i would say WATIN instead of WATIR, since WATIR is Ruby and WATIN is .NET ;-) watin.sourceforge.net But in general i agree with Andrew, no need to test OOTB functionality as such Jan 30, 2010 at 8:56
  • UI tests (e.g. Visual Studio coded UI tests, Selenium, Watin) are not strictly unit tests, which should test a unit of code (e.g. a function) in isolation. They also run too slowly in general to be useful for TDD.
    – SPDoctor
    Nov 27, 2011 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.