Making EPiServer code testable – the mild mannered rant
As I mentioned in my last post writing tests for your code isn’t hard. The big “but” you know is coming is that this is valid only if the framework you’re writing code for/in is built to be testable. Just as an example, to be able to write the tests I wanted for the scenario outlined in the previous post I had to write this code.
I also made use of some EPiAbstraction classes.
The code above is not too interesting but will be discussed in a later post. The point I’m trying to make is that you often have to spend a lot more time on making _episerver_ code testable than writing the tests themselves. This sort of makes the case of the “testing is easy” argument a hard sell.
Some closing thoughts
In all fairness (and please correct me if I’m way off base here) I don’t think the EPiServer team in the past has had too many requests from developers to focus on this area. I know that I personally didn’t care too much about it 3 years ago before I was introduced to the involved concepts. But I feel that as the sites we develop get more and more complex being able to, for instance, develop using TDD is becoming a must have.
So, here’s hoping for a more testable future.