|
|
|
|
|
by hakunin
5485 days ago
|
|
Instead of focusing on how (not) useful automated tests are, we need to admit one thing. They are often a daunting time sink, for whichever reason. You can make them habitual, but it's hard to sustainably enjoy writing them. You wish they took less time and gave more benefit. I bet if that was the case, we wouldn't have so many debates on whether tests are needed. In the recent story about human-powered airplanes they finally came up with the right question: "How can we make the flying machine easy to fix when it crashes?". Imo, here we need to ask the right question as well: How can we minimize the time consumed by test-writing while maximizing their usefullness? Maybe we should drop the practice of 1 assertion per test, or the notion that tests are also documentation. Maybe we should embrace integration tests. Maybe not. Maybe we should strip all the cruft around the point of tests "it helps you think, it documents your code, it leads to better design" and get back to the roots. Tests are there to make sure that critical parts of your code keep working. That's it. It's better that we sustainably write useful occasional tests for critical code than lie to ourselves about how disciplined we are, burn out, and condemn the whole thing. |
|