18 ms·
With tests, there's also the idea that writing them helps you write better code. That's something that doesn't happen automatically. If you approach tests as s
by mbrock 11y ago
With tests, there's also the idea that writing them helps you write better code.
That's something that doesn't happen automatically. If you approach tests as something you have to do because somebody told you to, and I think this is pretty common, then your tests are probably not going to be great, and it's not going to help your code...
But if a team really takes to heart the whole principle of testing, and start to design things with testing in mind... then they start to ask questions up front like "how will we really know that this works?" and "how can we isolate this component so that we can test it independently?" and "how can we write fast tests for this?" and "can we make this into more of a pure, simple data structure?" and so on and so on.
Especially this one: "How can we get the important business logic here to be a clear and distinct module with verifiable correctness?"
And that's a cascade of wonderful benefits. Enforcing a culture of "you must write tests" might possibly help with QA, especially in the more obvious cases of algorithmic correctness, but the true benefits are so much deeper.