SharePoint Services are challenging for unit testing because it is not possible to execute the SharePoint Service without being connected to a live SharePoint site. For that reason, most of the unit tests written for SharePoint are actually integration tests as they need a live system to run. In this session, we show how to use Pex, an automated test generation tool for .NET, to test SharePoint Services in isolation. From a parameterized unit test, Pex generates a suite of closed unit tests with high code coverage. Pex also contains a stubbing framework, Moles, that allows to detour any .NET method to user-defined delegates, e.g., replace any call to the SharePoint Object Model by a user-defined delegate.
Peli de Halleux from Microsoft Research presented this presentation on SharePoint Connections 2010 Amsterdam.
Peli is a Senior Research Software Design Engineer at Microsoft Research in Redmond, USA, where he has been since October 2006 working the Pex project. From 2004 to 2006, he worked in the Common Language Runtime (CLR) as a Software Design Engineer in Test (SDE/T) in charge of the Just In Time compiler. Before joining Microsoft, he earned a PhD in Applied Mathematics from the Catholic University of Louvain. Earlier, he developed the unit testing framework MbUnit.