Andrew Connell

SharePoint Emulators for Making SharePoint more Testable

In case you missed it, about a month ago the Visual Studio team announced an emulator for SharePoint classes which is basically a way for you to do unit testing leveraging Microsoft's mocking and testing frameworks (or someone else's). What happens is you wrap up your test code in a SharePointEmulationScope and that will keep the SharePoint objects from running calling a live SharePoint instance. One nice aspect is they are extendable so they don't do everything you want, just have at the tweaking yourself! The blog post mentions they are only available for SharePoint 2010 & when you are using Visual Studio 2012... no word on if they are supported with SharePoint 2013 yet. There's a bit of irony here... can't you see it? Finally we get something we've wanted for a very long time (I've heard this request going all the way back to the SharePoint 2007 release). The funny part is we finally get this right when Microsoft starts telling us to no longer write code using their SharePoint server side object model. Nice timing ...

In case you missed it, about a month ago the Visual Studio team announced an emulator for SharePoint classes which is basically a way for you to do unit testing leveraging Microsoft’s mocking and testing frameworks (or someone else’s). What happens is you wrap up your test code in a SharePointEmulationScope and that will keep the SharePoint objects from running calling a live SharePoint instance. One nice aspect is they are extendable so they don’t do everything you want, just have at the tweaking yourself!

The blog post mentions they are only available for SharePoint 2010 & when you are using Visual Studio 2012… no word on if they are supported with SharePoint 2013 yet.

There’s a bit of irony here… can’t you see it? Finally we get something we’ve wanted for a very long time (I’ve heard this request going all the way back to the SharePoint 2007 release). The funny part is we finally get this right when Microsoft starts telling us to no longer write code using their SharePoint server side object model. Nice timing!

Andrew Connell
Developer & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a web developer with a focus on Microsoft Azure & Microsoft 365. He’s received Microsoft’s MVP award every year since 2005 and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s the founder of Voitanos and is dedicated to delivering industry-leading on-demand video training to professional developers. He lives with his wife & two kids in Florida.