The Value of Testing
I just wanted a highlight a post over at the Caffeinated Coder because I thought it was particularly well thought out. In it Russell talks about his changing approach to testing after many years. Often when you read about TDD (or testing in general) it’s from a eager proponent who declares it to be the silver bullet for software quality and efficiency. While is certainly has benefits the pitfalls aren’t often discussed in a well rounded way. It seems to be a bit of a love it or hate it thing.
One thing that really resonated with me was the following:
“It also occurred to me that just because you write a test doesn’t mean that you have to commit it. There are several design artifacts (whiteboard, napkins, etc) that are extremely helpful despite being disposable. Occasionally writing throw-away tests would certainly allow me to gain the design benefit without incurring the cost of maintaining a test that has little long term value.”
I think that’s a very valuable point. Sometimes just writing a bit of code to exercise the code you wrote is enough and the extra effort to turn it into a complete test isn’t worthwhile. Even ignoring the initial cost of making the test repeatable and robust there is an ongoing maintenance cost that shouldn’t be discounted.
One language I’ve been getting to know recently is Clojure. One of the (many) things I love about Clojure is the REPL. Clojure is very well suited to exploratory testing. In Clojure it is very typical to build things from the bottom up. Write a bit of code in the REPL, call it, poke around and continue building on it. My point being that you can get a lot of value with this sort of one off “testing”.
Glen – I think there’s a problem with your post’s permalink – an extra character at the end seems to breaking the url.
Peter: I’m not sure where the extra percent is coming from but it seems to open in the browser regardless. Might be time to upgrade WordPress.