Unit Testing Sitecore using NUnit, serializing content

A while ago I came across this question on StackOverflow – Unit Testing Sitecore using NUnit, serializing content

I was lucky to successfully answer the question and provide information to the user dpwulp94 and also hope that this answer provided was helpful to other seekers as well.

My effort for this blog post is to put the information together in one place and update it periodically.


Unit Testing Sitecore using NUnit, serializing content

Anyone seeking Unit Testing in Sitecore should watch the below videos and there are plenty of others as well.

Interesting videos on Youtube

  1. Sitecore Unit Testing video by gravypower.
  2. Another interesting video by codeflood.
  3. Most knowledgeable for me was this video by Alistair Deneys from Hedgehog
  4. Advanced Glass Walkthrough video by Mike Edwards from Hedgehog
  5. Automated Testing with Sitecore V2 video by Alistair Deneys from Hedgehog

Other interesting blogs are

  1. Igloo – Unit Testing for Sitecore
  2. iStern – Unit testing with Sitecore Item by Thomas Stern
  3. Mocking Sitecore with MS Fakes Part I and Part II by Thomas Stern
  4. And lastly my preferred Coffee => Coder => Code again by Alistair Deneys
  5. Knifecore’s blog also helped me a lot when I was trying to write tests.
  6. Unit Testing with Sitecore by Reservoir Devs

The topic of Serializing Sitecore objects was also mentioned

We also want to mock the Sitecore data by serializing the Sitecore objects. I have been looking for, but could not find a good tutorial to do this. How can I do this?

Kern Nightingale has got a perfect presentation which will give you insight to how to use it for testing as well.

Would also recommend Sitecore Glimpse by Kevin Obee, the project’s one of the purpose is “provide build scripts that automate the tasks of compiling, testing and packaging the project artifacts to make it easier to open the project up for collaborative development” which he mentions on his blog.

To conclude hope this gives bit more perspective on Unit Testing and Serialization with Sitecore.

Happy Sitecoring!