4 ms·
Your massive test suite will tell you if you broke something. You have a massive test suite, haven't you? No! Your test suite is meant to be a last safety net
by joosters 13y ago
Your massive test suite will tell you if you broke something. You have a massive test suite, haven't you?
No!
Your test suite is meant to be a last safety net, there to catch you if you make a mistake. It's never something to rely upon. Your tests will never be comprehensive enough. Adopting a 'if the tests pass, all is OK' attitude, as implied by the article, is a terrible mistake.
- tinco 13y agoNot in the Ruby community. And I think dynamic languages in general. Your test suite should be comprehensive enough to cover something as significant as a deleted function. If you maintain the attitude that your test suite is a last safety net, then you will never be able to confidently refactor, which is what TDD in my opinion is all about.
- joosters 13y agoYes yes yes, your test suite 'should' be comprehensive enough. But is it? Are you sure? Instead of using the tests for confirmation, you should be reasoning about the code that you are editing to be happy that your changes make sense. Having the test suites as well is just icing on the cake.
- wlievens 13y agoVerifying whether your test suite is comprehensive enough is not that hard in theory, if you apply mutation testing.
- tinco 13y agoIt's not that hard in practice either. Besides mutation testing (which becomes a rather slow affair when your codebase is of significant size) you can just do coverage checks. If you have a simple branch coverage, that alone can guarantee (in most situations) which methods are used and which aren't in your tests.
- wlievens 13y agoActually coveragr only shows you that the code executes, it doesn't tell you if it's testef.