[kwlug-disc] Tests is a check-able manifestation of intent -- playing with analogies

Mikalai Birukou mb at 3nsoft.com
Thu Aug 4 09:42:57 EDT 2022


Playing with analogies.


1. Tests as a mold

In T(est) D(riven) D(evelopment) test suites are like a mold. Pouring 
plastic/concrete not into mold often creates a mess. With concrete, 
excavated ground often is an implicit mold.

Mold let's one pour code with minimal forethought, since mold is 
supposed to pass desired shape to code.


2. Tests as a scaffolding

Scaffolding, TheFreeDictionary: "a temporary metal or wooden framework 
that is used to support workmen and materials during the erection, 
repair, etc, of a building or other construction"

In building there is not enough hands, or hands may not exists that are 
capable of supporting something. In coding there is not enough mental 
attention to watch if things start to fall apart when change is done, 
hence need a help of an automaton.

We surround system with test suites, and then it leans on this 
scaffolding whenever code gets broken in a process of change.

If we start to erect scaffolding taller than an existing system, we 
start to use scaffolding as a mold, as a shape that dictate shape to 
newer parts.


3. Tests is a place of capturing an intent

Both mold and scaffolding say what code should be, what is an intent. If 
a particular part of intention was important, it was transferred into 
code of test, to be checked.

Code itself never holds an intent. Reader of the code second-guesses an 
intention. May be it is the part of a human brain that in weird cases 
assigns intention to wind and sun, often assigns automatically. Finding 
bugs is easier when this brain function is turned off. Except for those 
places where a particular intention coupled with quirks of a used 
language produces classical gotchas -- these are low hanging fruits in 
debugging.

Let's consider human dialog: " - You told me, you love me. - I do, look 
what I've done for you."

Even in human/social context only adherence to intent can only be 
detected/measured for a modicum of objectivity.

Code itself never holds an intent.We may say that tests capture an 
intention, but running test against code gives an objective signal about 
state of one's code, relative to intention distilled into test suites.


Are there other perspectives on testing phenomena in the industry?





More information about the kwlug-disc mailing list