December 19th, 2012

Unit Testing for Sitecore

One of the important disciplines of programming is to create your applications using a Test Driven Development (TDD) approach. Even though Sitecore makes this hard, there are a few things out there that can help us run unit tests.  One example is the test runner that Alistair Deneys created back in 2010

This test runner works very well but as I began to advance my knowledge of programming patterns and practices I came across Bob Martin‘s three TDD rules:

  1. Do not write production code unless it is to make a failing unit test pass.
  2. Do not write more of a unit test than is sufficient to fail, and build failures are failures.
  3. Do not write more production code than is sufficient to pass the one failing unit test.

and as I applied these rules to my work I wanted to start to use ncrunch (a continuous testing tool) so my tests could be running all the time.  This was not possible with Alistair’s test runner method so I began to use a method that Michael Edwards blogged about. Unit Testing Sitecore in the NUnit GUI.  This method is great so I made a screen cast


Posted by admin


Nice screencast Aaron.

I ended up doing this task so many times that I created a NuGet package to import all of the Sitecore config and assemblies required for a integration test project. It lived on an internal NuGet server so that it could be easily installed without breaching the rules around distributing Sitecore.

Comment by Kevin Obee February 04, 2013 @ 3:21 am

Leave a Comment

OK. Let’s get down to it. So what do you think of that? Agree? Disagree? Don’t really care? Got something to say. Then say it.

(won’t be published)