Topic: test(100%) == overkill?
Okay, it's confession time:
I recently finished a small project and there is absolutely no test coverage on it. I can already hear some of you fainting out there, and the ones left standing are freaking out..
"GASP!!! OMG!! But your application is not SAFE! Your code is UNPROTECTED! Only losers dont test first!!!" etc etc
I know ... I know.. I felt really guilty and promised myself that future projects would have test coverage. And for the last 2 weeks, I have made good on that promise.
My first impressions are that Unit Tests are indispensable. My model behavior, once specified is not likely to change that much and tests provide a safety net that allows me to refactor my code much quicker than before.
Where I start to get impatient is with functional tests. When you start working things like redirects into the equation, you start to violate DRY and lose some agility. I don't like the idea that I have to update my code in two different places if the client wants me to make a change.
Another gripe I have is that a lot of Test enthusiasts out there really go over the top. I mean is it really necessary to test things like ActiveRecord validations? Aren't they already well tested? I can understand trying to spec out something like user permissions, but I fail to see the point of saying
specify "should be invalid without username"
When we already know that validates_presence_of :username ALWAYS works.
Are people just obsessive compulsive about testing? Or am I failing to see the value of repeating yourself in a framework that preaches DRYness.
Please help me see the light!