Software QA FYI - SQAFYI

Test Trimming: A Fable about Testing

By: Gerald M. Weinberg

Throughout my career, I’ve watched in dismay as one software manager after another falls into the trap of achieving delivery schedules by trimming tests. Some managers shortcut test work by skipping reviewing and unit testing in the middle of their project. Others pressure the testers to “test faster” at the end. And, most frequently, they just drop planned tests altogether, hoping they “get lucky.”

I’ve written several essays about the dangers of test trimming, but nobody seems to understand, so I asked myself, “What am I doing wrong?” Perhaps I wasn’t practicing what I was preaching. Perhaps I was trimming tests myself. Perhaps my writing needed more testing!

So, I wrote a story about taking shortcuts and read it to my granddaughter, Camille. Here’s the story: Rhubarb Cakes for the Queen of the Forest

Once upon a time, all of the animals in the forest were in an uproar. Calling Crow had just proclaimed that in two hours, the Queen of the Forest would arrive for a visit to choose a new Royal Baker.

“She’s going to hold a baking contest,” Calling Crow cawed. “And the winner will be named Royal Baker?and win a prize of 100 pieces of gold!”

“What do we have to bake for her?” barked Burly Bear.

“Rhubarb cakes,” Calling Crow cackled.
“They’re her very favorite dessert.”

Rapid Rabbit ran nervous circles around a rhododendron bush. “Rhubarb cakes? But the Queen is coming in just two hours, and my recipe for rhubarb cakes takes three hours.”

“So does mine,” complained Canny Coyote.

Burly Bear sharpened his claws on the bark of an ancient aspen. “Mine, too.”

Prudence Porcupine popped up and headed for her kitchen. “Then I think I’d better get started, and not just stand around complaining?”

Each of the bakers pondered how they could make their rhubarb cake in two hours.

“I’ve got it,” thought Rapid Rabbit. “What takes the longest time is putting in a little sugar at a time, stirring for five minutes, and tasting to see if it’s just right. I don’t really have to test the sweetness a little at a time. I’ll just throw in the right amount of sugar all at once, and that should save me an hour.”

Burly Bear reasoned to himself, “I have the biggest oven, so I can put the cakes on the top shelf, in the very back where it gets super hot. And I can stoke the fire with lots and lots of apple wood because that burns hotter than any other wood. If I bake the cake at a higher temperature, I can save a lot of time and have it ready when the Queen arrives.”

Canny Coyote didn’t have such a big oven, but he figured, “if I just cut an hour off the baking time, the cake might be a little soft, but I’ll put in lots of sugar. The cake will be so sweet that the Queen won’t notice.”

But Prudence Porcupine had a different way of thinking. “I know my rhubarb cakes are delicious, but if I take any shortcuts, I’m pretty sure the cake won’t come out right. I’ll just tell the Queen that my cake is going to be late, but that it will be worth waiting for.”

When the Queen arrived, Rapid and Burly and Canny all had their cakes on display in the clearing, and the Queen was invited to taste each cake in turn.

She took a bite of Rapid’s cake and made an ugly face. “Yuck. This rhubarb cake is so bitter. Why didn’t you add more sugar?”

Then she turned to Burly’s cake and asked, “Why is this one all burned and black? Well, maybe it’s better on the inside.” But when she tried to cut a slice, the burnt crust was just too hard to cut. Instantly, the Queen moved to Canny Coyote’s table without even tasting the bear’s cake.

She tried to cut a slice of the coyote cake. “This cake looks rather mushy. Oh, it’s all gooey and runny when We try to cut into it. We think it would make Us sick if We put it in Our mouth.” (Queens always call themselves “We” because they believe they are speaking for the entire nation.) The Queen stuck out her tongue at the cake and refused to taste it at all.

Finally, the Queen turned to Prudence’s table and asked, “Why is there no cake here? We distinctly said that every baker was to make a rhubarb cake. Who dares to refuse a Royal Proclamation?”

Prudence stepped forward, bowed to the Queen and said, “My cake is in the oven, Your Majesty. It will be ready for your tasting in one hour.”

“But We said the cake must be ready NOW ” shouted the Queen.
“That was a Royal Order, and cannot be disobeyed.”

Prudence bowed so low her quills caught some fallen leaves. “Yes, Your Majesty. And I wished I could have made a rhubarb cake in two hours. But I don’t know how to make a cake that way that would be fit for a Queen, so I did my very best and took three hours. If you want to punish me, then you are the Queen and may do whatever you like.”

“Humph,” growled the Queen, thinking of suitable punishments.

Prudence brushed away the stuck leaves. “But the cake is in the oven now, and you can just begin to smell how tasty it’s going to be. In one hour, it will be fresh from the oven, and a fit dessert for your refined tastes. In the meantime, I’d be happy to tell you a story, to make the time pass more quickly.”

“What story?” demanded the Queen.
“I thought I’d tell the one about the Princess and the Pea,” Prudence offered. This delighted the Queen because that story was about her, when she was a young princess. So the Queen listened to the story, and laughed and cried and clapped so hard that an hour passed by very quickly.

Then Prudence put on her mittens, opened the oven, and took out a perfect rhubarb cake. The Queen loved it so much she ate the entire cake, with just a small slice for Prudence. Then she gave Prudence a woven bag with one hundred gold coins and announced to the whole forest that Prudence Porcupine, though she was at times a little prickly, was the Best Baker in the Forest and now would be the Queen’s Own Baker.

When I was finished reading, I asked Camille what was the lesson of the story. She said, “Burly and Roger and Canny were not real bakers. They were just pretending because they wanted to win the prize, but they didn’t know how to bake a real cake.”

“Very good,” I said. “But maybe they did know, but were afraid of the Queen.”

“If you’re afraid to do what you know is right, then you’re not a real baker.”

Camille, who was not yet five years old, understood this story perfectly, so it passed my test.

I wonder if forty-year-old software managers will be able to understand it?

Full article...


Other Resource

... to read more articles, visit http://sqa.fyicenter.com/art/

Test Trimming: A Fable about Testing