Unit Testing SharePoint – Getting into the Object Model
The white paper and associated code can be found here Unit Testing SharePoint Solutions – Getting into the Object Model
The first document in the Beginners Guide to Test Driven Web Part Development Series provided an introduction to unit testing, a look at how TDD influences your design and makes your code testable. That document deliberately avoided testing the SharePoint Object Model as in order to do this we need to introduce the concept of mocking.
This second document in the series will cover the concept of mocking, specifically looking at the new Typemock Isolator (V5.1.1 or later) AAA API to demonstrate testing against SPSite, SPWeb, SPList and SPListItem objects.
Some of the key things you should get from this white paper are
- How to unit test the object model
- These unit tests are much less brittle using the new Isolator AAA API
- You do not need a specific SharePoint configuration on your development machine, we are not Integration testing
- Reinforce TDD approach to SharePoint development
The white paper is part of the Beginners Series but introduces some fairly advanced concepts, as with SharePoint the learning curve can be fairly steep. You can work through this white paper on it’s own but I recommend looking at the first part as this goes into more detail about TDD.
The white paper and associated code can be found here Unit Testing SharePoint Solutions – Getting into the Object Model
We welcome you comments and suggestion for improving the current white papers and also ideas for the future.
