Skip to main content

Posts

Showing posts from April, 2014

Another Look at Unit Testing Umbraco Surface Controllers (Part 2)

With the release of Umbraco 7.3, this has got a whole lot simpler - see my more recent post discussing this topic In the previous post I looked at testing Umbraco surface controllers, using a technique that basically avoided the issue by extracting the non-Umbraco related logic for test into a separate class, and testing that. Another option is to test the controller as is, using the base test classes provided by the Umbraco core team. My starting point for working with these was a blog post by Jorge Lusar where he details much of the process for working with these. He used Umbraco 6.1.5, and I found things had changed a little in 7.1.0 (latest at time of writing), as well as needing some additional work to handle the controller methods I was looking to test. As Jorge notes, the first things is to get the test classes. They aren't currently available as a separate download as far as I'm aware, so instead I've pulled down and built the latest source code, and t