[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: writing test cases

From: B. W. Fitzpatrick <fitz_at_red-bean.com>
Date: 2001-03-06 04:11:25 CET

> Many of us implementing the filesystem interface have now gotten into
> the habit of writing the test cases (see fs-test.c) *before* writing
> the actual code. It's really helping us out a lot -- for one thing,
> it forces one to define the task precisely in advance, and also it
> speedily reveals the bugs in one's first try (and second, and
> third...).
>
> I'd like to recommend this practice to everyone. If you're
> implementing an interface, or adding an entirely new feature, or even
> just fixing a bug, a test for it is a good idea. And if you're going
> to write the test anyway, you might as well write it first. :-)

+1. I also find that having a test case for my public
functions/methods encourages me to refactor the implementation of some
things without fear, thereby leading to better code...much in the same
way that I was more willing to try things out after putting them in
CVS. :)

Hmmmm... I'll have to see how I can do this in the client now.

-Fitz

FWIW, this is one of the big tenets of Extreme Programming (a poorly
chosen name if I've ever heard one) and I find it very useful.
Received on Sat Oct 21 14:36:25 2006

This is an archived mail posted to the Subversion Dev mailing list.