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.

Add New Comment
Viewing 12 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)
November 12, 2008 at 2:00 pm
[...] Unit Testing SharePoint - Getting Into the Object Model (Andrew Woodward) [...]
November 25, 2008 at 5:35 am
[...] model. However, Andrew Woodward recently posted a whitepaper on the subject that caught my eye: Unit Testing SharePoint Solutions ...
December 23, 2008 at 5:38 am
[...] http://www.21apps.com/agile/unit-testing-sharepoint-getting-into-the-object-model/ [...]
January 8, 2009 at 9:33 pm
[...] 11)Andrew Woodward:http://www.21apps.com/agile/unit-testing-sharepoint-getting-into-the-object-model/12)Jake Dan Attis : [...]