Do Tests Get Too Much Respect?
I’ve recently read Phil Haack’s post about “structuring unit tests”. And then Ayende’s response. I’ve also went over the comments on both posts, and clearly, most were in favor of having some kind of method to structure or organize test code.
I used to work with someone who was very VERY organized. His Outlook had dozens of folders and sub-folders. He know exactly where to file each email, and consequently, where to find each email. If I were looking for something and couldn’t find it, I’d turn to him, and he would find it rather quickly because everything was filed according to a “system”.
Mind you, mostly I find email. I keep all my past emails in one folder called “backlog” and use the search box.
Who’s system is more organized? My friend’s, obviously.
Which one is more effective? Now that’s a different story. The search box finds things much quicker. There’s also a penalty in the filing system. For each email, my friend needs to think where it belongs. What if it deserves to be in two places? The filing itself is costing him time.
See the resemblance?
Reading all the comments that favor the structuring method, or any method, and stating its not much work and effective, made me think: Have these people lost their mind? Have they lost sight of what’s really important?
Tests have a primary goal: to tell us we’ve broken something. Once I write a test, I hope and pray I’ll never ever see it again. Because if I do, something’s broken and I’ll need to fix it. Otherwise, this test vanishes between the other hundreds or thousands of tests. Which is fine by me. If the test fails, my test runner will get me there in two clicks.
It seems that along the way, we’ve placed too much respect upon our tests. No wonder, since we’ve crowned TDD as a “design method”. Obviously tests are not mere code, they are a design tool. and therefore should be treated even better than production code.
What’s important is working production code.
Tests are the most effective tools to get to working code. But let’s put things in perspective: they are just that – tools.
And the upcoming Typemock Isolator V7 is all about a new perspective.
Easy Related Posts
7 Benefits of Unit Testing
We as developers hesitate to add unit testing to our work routine. Some refuse to ...read more
All your bases belong to us part 1- Changing Behavior
Handling ‘hidden’ base methods is tricky when testing components.A ‘hidden’ base is a virtual method ...read more
The Art of Unit Testing
As Roy Osherove wrote in his book, The Art of Unit Testing, “Unit testing isn't ...read more
Four things that blew my mind with “Typemock Isolator”
I just started working at Typemock a few months ago and the company decided that ...read more