This post was triggered by thoughts following on from a Michael Bolton tweet and blog post making analogies to explain that test cases are not tests.
The analogy (a test case is like a recipe, and the testing you’re doing is the cooking) is interesting in that it helped me realise why people often love test cases so much.
As a student, I used to cook without recipes. And the food we made was.. edible. And we didn’t know better (and besides we didn’t have much to spend on the ingredients). Then as a graduate in my first job, being paid real money and everything, I discovered (a) more complex ingredients and (b) cookery books. For geeks. With detailed recipes and everything. And I loved it. My results when cooking were much tastier, and crucially I discovered the more detailed and precise the recipe, the better the result. I craved detail and precision – and my results were better for it.
My wife is an excellent cook. She knows what she’s doing, how flavours work together, and her sense of taste is exceptional. When she cooks from recipes, she doesn’t care about the great detail. She’ll start on the recipe – and then substitute half the ingredients, swap all the timings around and end up with something technically different, but that tastes way better.
I can’t replicate what she does, even when I used to write down all the tweaks she made, because what she’s doing is cooking – reacting and working with what’s happening in real time – nailing that down and turning what she did into a detailed recipe and repeating that makes things worse – because so many other things are going on that aren’t written down.
And that, I think, mirrors into testing. CDT testers have developed an allergic reaction to test cases (detailed recipes), and that’s a good discussion to have and way to think for people who are already basically competent cooks and can be freed from the recipes into thinking for themselves. (Now I’ve got some reasonable cookery skills, my cooking has improved significantly since I’ve stopped worrying so much about the details of the recipe.) However, for people starting out, the reverse is true. Following a nicely well constrained test case gives demonstratably better results than them fumbling around in the darkness, and so they react badly to people telling them that contrary to their personal experience, the reverse is true. Instead of telling them “recipes are bad”, we need to tell them that recipes are ok to enable them to start their journey to become a good cook – but that following a recipe by rote does not make them a cook, or improve their cooking skills. We also need to help teach them the skills of cooking and encourage them to explore around their recipes and onwards, so they can take pointers from recipes and do their own thing.