SharePoint Emulators Simplifies Unit Testing
Microsoft has announced the availability of Visual Studio 2012 SharePoint Emulators which provide a module of Microsoft Fakes based shims and implements the basic behaviours of the SharePoint 2010 server object model.
In order to incorporate emulators into existing tests you should wrap the relevant code in a SharePointEmulationScope, which accepts EmulationMode enum as a parameter. It is enabled by default which in turn performs run time interception of all Microsoft.SharePoint.dll calls. Moreover, the relevant code will be automatically detoured at runtime and all calls against the Microsoft.SharePoint.dll assembly will be rerouted to the SharePoint emulators.
"SharePoint Emulators rely entirely on the Microsoft Fakes framework. They consist of concrete implementations of shims. However, developers will be able to reuse the same code when there is a need to run tests against a full blown SharePoint server," says Joshua Weber, Visual Studio 2012 Program Manager.
Visual Studio 2012 SharePoint Emulators are available via a NuGet package feed and requires Microsoft SharePoint 2010 Server and Microsoft Visual Studio 2012 Ultimate.In his blog post, Jousha examines the usage of emulators and also examines the steps required to extend the emulator.
"In order to unit test a SharePoint code, you need to isolate code. However, this technique is very costly and it is in this context SharePoint emulators will come in handy," says Joshua. He also feels that running tests against emulators provide significant performance improvements and reduced maintenance of test SharePoint infrastructure.
Educational Content
Concurrency in Clojure
Stuart Halloway May 17, 2013
Confessions of an Agile Addict
Ole Friis Østergaard May 16, 2013
Web Development: You're Doing It Wrong
Stefan Tilkov May 16, 2013
Programming The Feynman Way
Ben Evans May 15, 2013





Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think