Archive

Archive for January, 2013

Unit Testing SharePoint 2013 with Visual Studio 2012

Hello Once More

Yes it is possible to do this and its easier now than in Visual Studio 2010.

If you own Ultimate then there are shims and mocks ready rolled but if you don’t you can use SharePoint itself.  This will make these Integration Tests rather than Unit Tests but having been using them for a day I’ve already caught three minor issues in under an hour.

  1. Use Visual Studio to create your SharePoint project as normal.
  2. Use Visual Studio to create a Test Project as normal.
  3. Add a project reference from the Test Project to the SharePoint Project.
  4. In the Test Project ensure that Test > Test Settings > Default Processor Architecture > X64 is selected in order to avoid this error:

Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable.

Then write your user tests as normal and off you go.

Cheers

Sebastian

Categories: Development, SharePoint