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:
Or you can view them inline below.
Test prep
Writing unit tests
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:
//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); outputWriter.SaveTestResult(result); } else { base.Render(writer); }