I think I know why people don't value tests
I think I understand why people tend to not write tests. Because they
believe that tests aren’t something that’s either needed or important.
“Duh,” I hear you say, but bear with me.
Why don’t people believe that tests are something that’s either needed
or important? Well, I think one of the biggest contributing factors to
WHY is that essentially zero of the learn to program in language FOO
books ever mention unit testing. Unit testing has been around in a
formal sense since the creation of SUnit back in
1994
! 1994 I say! That’s thirteen years now. Thirteen years and I could
probably count on one hand the number of introductory language, or
language reference, books that not only mention unit tests but actually
explain why their important and how to use them. Even worse, most
languages don’t have unit tests tools built into their core libraries.
All the modern languages have fairly comprehensive test coverage but
they have to use external tools to write those tests. How crazy is that?
We have this common programming task that we all agree is critical to
releasing a stable version of the language but it’s not important enough
to build into the language. Wha?!?! The end result is that since we
don’t teach tests as being even noteworthy when teaching a language
no-one learns that they are important. For the most part people just
don’t seem to understand the value of tests until they’ve been in the
industry so long that their feet are riddled with holes.[1]
Mike Clark, and others, suggest [writing “Learning
Tests”](http://clarkware.com/cgi/blosxom/2005/03/18#RLT1 “writing “Learning Tests””)
as a way, not only to learn a new language, but as a way to accrete a
repository of what you’ve learned about a language. I think this is a
GREAT idea. Imagine if every book that taught a new programming language
showed you not only how to do something but then followed it up with how
to confirm that you didn’t screw it up by demonstrating how to write a
test for it? People would start to see test writing as a standard part
of the software writing process. It would be “just what you do.”
Imagine the impact that including unit testing as a standard part of
the learning process would have on the software industry! Sure it might
take five to ten years before we started to see the results from it but
wouldn’t it be worth the wait?
[1] From having shot themselves in the foot on many prior occasions.\