Chuck Esterbrook wrote:
Do I call that a unit test? Or simply a regression test? Or something else?
The lines are blurry. I don't draw a lot of distinction between unit
tests, framework tests, functional tests, regression tests, etc.
Why?
Most of my tests get written in response to hunting down bugs. Quite
often, this plunges down through many layers. I wind up writing some
chunk of code--it doesn't work. I then isolate the behavior I expect
and the behavior I get--that's probably a functional test. I then start
diving into the system to isolate the problem--that moves into the
framework level. Finally, I have to write a couple tests that isolate
the actual broken function and verify that I've fixed it--that's
probably a unit test.
I don't adhere to "it's not a real test unless it isolates one single
thing". That's a waste of time. Good functional tests activate a lot
of the entire system. Good unit tests isolate small parts of the
system. They both have their uses.
Let me provide an example:
I wrote some R-Tree code. This is pretty straightforward spatial
indexing stuff. My functional tests put stuff in, query it, and take
stuff out. Things worked fine. My tests stop there. At one point, I
changed the insert algorithm from quadratic to "linear". Stuff broke.
At that point, I started writing tests for the "linear" insert to find
the problem. Surprisingly, the problem was actually in the published
algorithm and nobody had found it before (VLSI has different query
characteristics from geographic processing). That got isolated by a
unit test.
The only thing I am religious about with respect to testing is that all
tests should be automated and runnable with "make test" or the
equivalent. Manual tests eventually don't get run.
-a
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg