“Why don’t you believe in testing?” said Lanette Creamer, the Testy Redhead. Ah, but I do. I care about what, when, and at which end of the horse.
It’s really hard to get one’s ideas into 140 characters, but these twitter conversations can help to crystallize things. Here’s what I’ve got right now …
Some programmers don’t appreciate some testers, sometimes, and I suppose that some don’t appreciate testers ever. There are some good reasons for that, and good things to do about it.
Don’t Nobody Bring Me No Bad News
This wonderful line from The Wiz pretty much summarizes how most programmers feel about bug reports. They busted their brain trying to make something work, tested it in that way that they have, and after a while some tester comes back with bug reports on their work. And the tester probably couldn’t have programmed the thing at all. Frankly, it’s bloody irritating.
Ron Jeffries: Some people take everything personally.
Ann Anderson: I do not!
Sometimes we get confused between our craft and ourselves, especially if we have worked hard to be as good as we are, and yet have some inner fear that we are not good enough. And in programming, we always have that fear. As hard as we try, we seem often to write bugs, and every time we succeed, they bring us something harder to do.
The result is that a bug report hits us where we live. It’s always evidence of something we should have thought about, noticed, tested for. It’s always evidence that we aren’t all that good at what we do. Here are two things I do about that:
1. Accept That I Fail
As long as I let myself live in the fantasy world where I am the all-conquering software hero with lightning crackling from my fingertips, it’s going to be hard to deal with the real world whacking me upside the head with bug reports.
For myself, I try to notice every mistake I make, and I look at it ruefully but not in sorrow. It’s evidence that I’m human, but by noticing each and every one, it is also evidence that I am paying attention, open-minded, and a very snappy dresser. The better I face my own reality, the better I’m going to be able to make the real world like my fantasy one.
2. Try to Put the Tester Out of Business
OK, even snappy dressing realist that I am, I still don’t like those perpetual gleeful interruptions from my testers saying “Look! I found another flaw in your world view! Nanner, nanner!”
OK, I know they don’t actually say that. That’s what I hear, however. So since I don’t like this bad news, I do things to reduce the opportunity for them to come tell me about problems. The only way I know to do that is to send them fewer problems: they’re way too good at finding them.
I think of this as trying to put the tester out of business. I try to write code that works so well that they tear their lovely red locks out of their head, crying out in frustration: “Won’t this guy ever write a bug? What shall I ever do???”
I hasten to say that I’ve never managed this. But we try. By trying never to ship a bug, I have managed to reduce my bug count profoundly, with the result that the things the red-headed demon finds are at least more interesting, and often enlighten me rather than just make me feel stupid.
I work on this in a few ways. Technical: Test-Driven Development and Automated Acceptance Tests Checks. Process: Root Cause Analysis. We won’t go into those deeply here, as we’re looking at a larger picture. However,
Test-Driven Development requires me to write all the code, and only the code, that is needed to pass tests, which I write first. This discipline helps me focus on what the code must do before I focus on how it would do it, and it results in code which is simple and quite testable. TDD is not a rote, stupid practice. It is, instead, an almost meditative way of keeping my mind focused on what’s going on. It reduces my defects a lot, and my tension even more.
Automated Acceptance Checks amount to automated examples, checking whether the program does what the customer has asked me to do. I ask the customer for examples, code them up in some acceptance checking tool, verify that they are what is wanted. Then, since I am no fool, despite reports to the contrary, I run these checks as I develop. Since they are automated, this isn’t much of a burden, and when they run correctly, I am confident that my program does everything the customer and I agreed to.
These two practices profoundly reduce the bugs that I ship downstream. The result is that when my tester does find something, it’s much more likely to be something that no one thought of. But here’s the clincher:
Root Cause Analysis means that whenever the Ginger Marauder does show up with a bug, we all talk about what permitted that issue to slip through our net of question asking, example making, automation of checks, and micro-tests. We actually learn something, and usually it’s not all about me, but about how we ask about features, and how we create examples.
This brings us to the horse. I knew there had to be a pony in here somewhere.
Come to the Front of the Horse, Tester!
Lanette told of a time when, after she told a programmer how she planned to test something, the programmer changed his design. Damn betcha! If I knew how my code was going to be tested, I’d make sure that it would pass. Therefore …
When the customer gives us a feature, let’s involve our testers right away. Let’s have them help make up the examples they’re going to use to check the program, and we’ll use them to build the code. Let’s automate them, and save us both some time in checking things. If they’re up to it, they can help automate the tests. And as we work through the examples, we’ll have someone to ask when we find an example confusing. We can keep ourselves all in alignment about what we’re doing, even if as we go, our understanding changes a bit.
I Love a Parade …
I like to think of this in parade terms. When you’re working a parade, it is better to march in front of the horses, rather than behind them, sweeping up. Worse yet, what if they are elephants?
When testers work behind the horse (save the elephant remarks, thanks), mostly they find defects that could have been prevented earlier. This takes up much of their time, and annoys the pig. It slows down the project and means that neither testers, nor anyone else, has time to look at the really important and interesting things that a good tester can find.
So now we see why I say “Try to Put the tester out of business.” It would be better to say “Try to put the checker out of business,” and by golly I’m going to say that from now on. I’ll start right now.
Try to Put the Tester Checker Out of Business
When teams move their testers to the front of the horse, allowing them to help create the examples that will be used to check whether the feature basically works, good things happen:
- We get a better understanding, and a common understanding, of what needs to be done.
- Programmers use the examples to ensure their code works, especially if the examples are automated.
- Naturally, our testers still move behind the horse. When they do, though, they aren’t doing as much checking. They aren’t just sweeping up crap. Because of the up-front checks, they can keep their eye on the bigger picture. They can use stronger and deeper testing skills to find things that are both more interesting, and more valuable, to the team.
For me, there are benefits to all three of the steps here.
TDD helps me write code that is better in every way, while reducing my stress. It also reminds me that I’m fallible, which I might otherwise forget.
Examples help me understand what my customer wants, and automated examples help me make sure I’ve done it, without a lot of extra work.
Moving testers in front of the horse makes my work go better, and reduces the amount of rote checking they must do. This makes them and their work more valuable.
Move testers to the front of the horse, to create more understanding and better examples. Automate to make it easier for everyone to check the examples. Code with TDD. Leave time for true testing, not just checking. Better software, sooner, with less pain.
What’s not to like? Do it.
 I’ve added “Try to”, to emphasize that as much as we try never to ship a simple defect, we’ll always have some. We can, however, reduce dumb mistakes by one or even two orders of magnitude.
 Thanks to Kent Beck for this delightful phrase.
 My good nemesis Michael Bolton makes the distinction between “checks”, which are pretty mindless automated, well, checks, and “sapient testing”, which is testing done by an actual human with eyes and mind wide open.
 Stop me if you’ve heard this. Guy works in the circus, shoveling up elephant do after the elephants do their business.
Friend asks him: “Why don’t you quit that awful job?”
Guy replies: “What, and leave show business??”
 Apologies for sudden shift of animal metaphor. Something about teaching a pig to sing. Never mind. As you were.