Fragile Tests
Those of us who have fire alarm(s) installed at home must have gotten ourselves in situations where we open the oven to get the sizzling-hot-double-mozzarella-pizza out, ready to slice it and transport ourselves in front of the TV. Then the smoke detector goes off announcing to everyone in the building that this guy’s having pizza again and forgot to close the kitchen door before taking it out of the oven.
Every time I see/hear the term Fragile Tests, I can’t help but think of my smoke detector at home, which, either doesn’t like pizza that much, or is really devoted to performing its duty of detecting smoke and preventing hazards.
There are a million derogatory descriptions tests can be decorated with. They can have their intent buried, they can be badly named, they can be testing too many things at a time, they might be irrelevant, and on and on, but one thing tests cannot be is fragile. Unless, that is intended to mean good fragile.
Alongside a few other things they must do, tests are really supposed to break. Whenever a tests breaks, that’s a good thing. A breaking test is trying to communicate one of two messages: It’s either complaining that we’ve broken something during our effort to make things work, or that we’re not providing it with the correct fail conditions. Either one must be fixed, because tests, like all things robot, when acting inappropriately, it’s because we told them so.
Tests are there to embarrass us to our neighbors for forgetting to close the kitchen door when taking the pizza out of the oven and be the first ones to start shouting at the slightest signs of smoke.
