I posted a couple of days ago that I was going back to basics on a new
model and filling in missing test cases. Part 1 was easy, part 2 took me
off-and-on until today, and part 3 lies ahead.

Sobering. Humbling. Great.

Is it kind of boring to write test code? Sometimes yes, sometimes no.

Did I find a host of little bugs that I *never* would have found by reading
the code. Yes.

Did I spot some related routines with pointlessly different parameter
lists? Yup. Fixed those.

Did I find some of my compound parameters (objects) needed more scrutiny,
consistency and validation. Yes, yes, and also yes.

I have hundreds of specific tests but it only takes a few seconds to run,
particularly compiled. When something goes wrong, I can zero in on code
that does just that one thing. It's so much easier to find a weird behavior
when you've got a very small piece of code that demonstrates it.

Did I violate the wise words of testers and change my code as I went? I
did...I ignored all of that. But I did have test cases in place. So, when I
changed some code, I'd run my cases and - sure enough - something unrelated
pops up from time to time that needs fixing.

For what it's worth, my code can have a lot of 'bugs' because my code does
a lot of input validation. When there's something wrong, I set an error
(I've got an error stack) with a descriptive name, error location (just a
method name), and diagnostic text (optional.) So, if a routine modifies the
error name that comes back or the size of the error stack (2 errors instead
of 1, for example), I count those as "bugs." So, it's not hard for me to
introduce a lot of "bugs", find them, and then clean them up.

There are a couple of things that make all of this test code worth the
trouble:

* As I change code, I can run existing tests and see if anything catches.
In an ideal world, I'd immediately spot any unexpected bugs.

* Going forward with well tested code, you're less likely to have bugs when
you put modules together.

* When a bug slips through all of this, you have to figure it out like any
other bug. But then you can go back and see how the bug got through your
tests cases. And fix the cases. And any similar cases.

If anyone is working on automated testing and feels like comparing notes,
drop me a line.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to