|Number of votes:||1|
I recently tried to help in a thread about unit testing and EPiServer and it ended up in a little discussion on how to and what to do unit testing on.
I am no fan of TDD and do not like having a lot of unit test in a project. That does not mean that I do not think there needs to be any test in a solution, what I mean is that it should be test for those things that are very important and not for those things that “should work” like for example getting a page from the CMS. The IContentRepository.Get<>() should EPiServer be responsible for to have tested before releasing the software.
I also having problem with mocking away to much, I have seen test where everything has been mocked away so the only thing that was tested was the mocking, so the test did not do any good at all. I like test that test the whole thing and that is not a unit test, but a integration test or maybe a behaviour test. When I use unit test is mostly when building up new functions or solutions where I want to write a lot of logic that depends on for example a response from EPiServer Find and I do not want to wait to fire up the whole site and then typing in a query, do the request and then use the response. Those times I mock away EPiServer Find until I am almost done, then I start to use the “real” thing.
I am hoping this blog post can be a starting point for a login discussion on when to do unit tests and when to not do it and I am working on some examples where I thing it is good to have them that I will show here.
So… What do you all great developers out there think? Please help me make this a interesting and good blog post