OK, so in this post I decided to put on display my total ignorance toward unit testing.
I just read Chris Tavares article on ASP.NET MVC. It is by the way, a good introduction to ASP.NET MVC.
However one thing i stumbled upon was the unit testing part. For example the “HelloController” is less than 20 lines of code, and the unit testing is more than 20 lines of code.
I dont’ get it!
You have just doubled the amount of code in terms of lines of code.
I fully understand the benefits of having a load of unit test and fire them on your code after a big change/refactoring. however I can not see how this will not end up in a maintainance nightmare.
For example if you change the design of a class, which you probably do sometimes, you have to maintain the unit tests to test the new design.
So i am trying to find ways of getting the benefits of unit tests, but not having to maintain them. not sure if Behaviour Driven Development is something.
P.S. The original thought of the MVC was seperation of concerns, unit testing wasn’t coined until later.
So I guess that you can say that when you design for seperation of concerns you automatically get the benefit that it gets easier to unit test each individual concern.
P.P.S. What if you have errors in your unit tests - do you start to test the unit tests as well?.
This is sickening to me, the tool that should help you develop with more confidence, is now one of your major concerns, not a helping tool.