codeflood logo

More Unit Testing in Sitecore Videos

I've finally found enough free time to record the continuation of my first unit testing in Sitecore video which showed how to add a test project to your solution which used the codeflood custom NUnit test runner. The next video was a little larger than I expected and I had to split it out into 2 separate videos.

The first shows how to prepare your unit test fixture for writing tests by creating the content the test requires and then destroying that data at the end of the test. The third video shows how you can write unit tests against the known content structure and test the method I showed in the first video.

You can find all 3 videos on YouTube:


This is great stuff! We're trying out your test runner on a project and so far it's working well. One hurdle we came across was getting the tests to run automatically by our CI server (Hudson... or is it Jenkins now?) It turned out to be fairly trivial:
- We extended your test runner to accept a Query parameter to indicate "auto" mode
- We overrode the Render method to output the standard NUnit XML results file when auto mode is detected. Note, you need to reference the nunit.util.dll assembly to build the XML output
- Hudson runs wget on the Test.aspx page post-build, and pulls down the resulting NUnit XML results
- Hudson parses the results and reports the status
//Code Snippet for generating NUnit XML results
//If we're running on auto, output the nunit xml
if(isOnAuto && result != null)
Response.ContentType = "text/xml";
NUnit.Util.XmlResultWriter outputWriter = new XmlResultWriter(writer);

Alistair Deneys

Thanks Joel, I'll include an option like that in the next release of the test runner.

Leave a comment

All fields are required.