Book Deep-Read · Software Engineering at Google · Chapter 11

Testing Overview

Software Engineering at Google · Ch 11 · Testing Overview · Adam Bender · 2020

中文 →

What is this chapter about?

The software behind Google Search changes almost every day, yet you rarely see it suddenly break. This chapter is about one of the reasons: letting machines check the software over and over instead of people (automated testing), and how Google turned that into a company-wide habit.

A strange thing first

You'd think tests exist to catch bugs. This chapter says something just as important: they let people dare to change code. In 2005, the team running the web server behind Google Search was at one point shipping releases where more than eight in ten carried a user-visible bug and had to be pulled back. Everyone was nervous about making changes, and work slowed to a crawl. Then the team adopted one rule: every change must come with automatic checks. A year later, emergency fixes had dropped by half, in a year when they were changing more than ever.

Why the old world was hard

The old way was a room of testers clicking through everything by hand. But today's search has to find flights, movie times and images, multiplied by every language, country and device. Nobody can click through all that. Worse, even if every engineer is excellent and makes just one mistake a month, a team of a hundred still produces five new mistakes every working day. Clever people alone don't survive scale.

How it works, intuitively

What it brought / how to choose

Google never ordered anyone to write tests. Instead it used new-hire classes, a one-page testing tip posted in restroom stalls every week, and a leaderboard that ranked teams, until "testing is everyone's job" became the default culture. The honest cost: writing tests takes time, a big pile of tests needs looking after, and some things, like whether a search result is actually good, still need human judgment.

One line to remember

Tests aren't only for catching mistakes. They let many people safely change the same code every day.

Want the two separate axes of size and scope, the 80/15/5 mix, the ice cream cone and hourglass anti-patterns, why a one-in-a-thousand flake rate hurts, and why coverage numbers mislead? → Switch to the deep read