1

I am currently using CSOM to upload/download files from SharePoint 2013 sites. I would like to know what would be the best way to unit test my operations. Is there a way I could create a fake SharePoint site within my test and then running my tests against this fake site.

For starters I would like to know how I could unit test this var clientContext = new clientContext(url).

I would first like to create a fake SharePoint site with this url and then test this above piece of code to check if the context was loaded or if there were any errors. The urls will be dynamic based on some conditions and I would like to test if for a particular condition the particular context generation was successful or not.

1 Answer 1

1

Yes, you can create a "fake" SharePoint site using the SharePoint Emulators. This process is covered in detail in this talk from TechEd 2013

Testing and Debugging Microsoft SharePoint Applications with Microsoft Visual Studio 2012

Visual Studio 2012 updates 1 and 2 have introduced a host of new capabilities to make it easier to test and debug SharePoint 2010 and SharePoint 2013 applications. In this demo-packed session, see how you can write unit tests for SharePoint which can run with the aid of SharePoint Emulators, without requiring a physical SharePoint deployment. Learn how to author coded UI tests which allow you to script tests which simulate users interacting with your SharePoint applications. Learn how you can compose web performance tests into load tests which can be used to test the performance and scalability of your SharePoint applications. Finally, see how IntelliTrace can be used to go deep into the SharePoint stack and understand exactly what’s happening when things go wrong.

1
  • 1
    Unfortunately emulators is for the server object model only. Commented Feb 22, 2015 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.