[TIP] testing: why bother?
jkakar at kakar.ca
Sat Mar 26 06:24:27 PDT 2011
On Wed, Mar 23, 2011 at 2:06 PM, Alfredo Deza <alfredodeza at gmail.com> wrote:
> I am about to give a presentation about testing in a couple of days and the
> audience is in its majority a
> "we do not write tests" one :(
> If you had to name the single most important reason why you need to write
> tests (or keep up with them) what
> would that reason be?
> You can reply with multiple ones, but I am interested in the one you think
> is *the* mot important one.
> One thing to consider though is to think about the problem from their
> perspective: "Why do I need to write tests?"
> I want to make a dent in that crippled thinking!
> I also posted the question in Convore but not everybody is in there, plus I
> know that I get the best quality
> testing-related answers here :)
> Any feedback is *greatly* appreciated!
It's too late for your talk, obviously, but unless I missed something
in the thread, no one mentioned my primary reason for doing TDD:
It's the fastest way to develop software.
My goal is to write software that is:
- Easy for my users to use (and, per the above, something they can
trust and take delight in)
- Easy for me and other programmers to understand and change
- Fun (for everyone)
TDD helps me achieve these goals because I end up with:
- Better design (actually, I'm not sure it's that as much as I avoid
bad designs, because I often realize they're bad before I've written
a bunch of code).
- Consistent velocity. When I have a good test suite I rarely get
into a situation where I lose many hours (or days) trying to debug a
problem. This is a big part of "fastest way to develop software".
It doesn't matter if I can write a few functions faster now, without
tests, if I can't sustain it over time. My experience has taught me
that I struggle to sustain a high level of productivity without
- The ability to experiment and refactor confidently.
- A consistent feeling of achievement that makes the whole process
more engaging and more fun.
I could go on, but the basic point is that I haven't found a way to
meet my goals any more quickly than by using TDD. If I could do less
and move faster to achieve my goals, I would, but I haven't figured
out what that looks like yet. Perhaps better programming languages
will reduce/remove the need for testing in the future.
More information about the testing-in-python