A moment’s epiphany in a highly caffeinated brain; a metaphor:
a unit test suite is a spiderweb![1. When done well]
Why?
- It’s lightweight
- It’s sufficiently robust
- It catches a casual bug passing by
- It’s most useful if the maintainer reacts to a bug catch immediately
- It needs occasional maintenance
- It’s not watertight, but good enough
- Some are beautifully designed, some look like a tight cloth, some are a mess
- …insert your analogy…
There is an already established XP metaphor of a safety net for the people and the business, to which I fully subscribe. This “lightweight net” metaphor, I hope, adds another flavor to the test-suite-as-a-net analogies, especially, to lightweight unit test suites, by describing which qualities unit test suites can have.
We now know that small (biological) bugs and other small creatures can cause a lot of harm, just as tiny software bugs can and do. [1. As a corollary: one can catch larger things by being a large cat, and applying different powerful strategies, but that requires quite a muscle mass, and a good connection to the ground. P.S. no lightweight vs. non-lightweight preference comparison intended.]
The analogy might have been a cheap trick of my brain. Nonetheless, it is now externalized, and I can go to sleep.