BT

SharePoint Emulators Simplifies Unit Testing

by Anand Narayanaswamy on Nov 28, 2012 |

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.

Hello stranger!

You need to Register an InfoQ account or 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

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT