Unit testing 001

“Man, I just love unit tests, I’ve just been able to make a bunch of changes to the way something works, and then was able to confirm I hadn’t broken anything by running the test over it again…” — http://stackoverflow.com/a/67500

The benefits of unit testing are well known, as are the many reasons that are offered when asked “Why don’t you do it?”. The arguments I hear over and over are:

  • “It takes too much time.”
  • “Our code isn’t suitable for unit testing.”

I’ve discussed unit testing with many people in the past years and at some point, I discovered one of the main reasons behind the arguments that were actually offered. We human beings find it much easier to say “It’s not possible”, “It’s too expensive”, “I don’t want to” or “I won’t start doing this until I’ve seen it work” (this one I encounter surprisingly often and makes me smile nowadays) than to admit:

  • “I don’t know how”

Contrafreeloading

“Jensen discovered (and many subsequent experiments confirmed) that many animals — including fish, birds, gerbils, rats, mice, monkeys, and chimpanzees — tend to prefer a longer, more indirect route to […]

Testing and refactoring

“When you don’t really know how long it is going to take to add a feature and you suspect that it will be longer than the time you have, it […]

Kompas

“Vroegere generaties hadden zich altijd gevoegd naar de normen van buren en geloofsgenoten, maar uiteindelijk luisterden ze toch vooral naar hun innerlijke principes, of die nu rood, christelijk of anderszins […]