3 ms·
From the paper: "Throw away tests that haven’t failed in a year." Hell, no. Our unit tests provide reassurance that when somebody revisits a component N years
by peterclary 13y ago
From the paper: "Throw away tests that haven’t failed in a year."
Hell, no.
Our unit tests provide reassurance that when somebody revisits a component N years from now, and makes a change, they are significantly less likely to break the existing behaviour, even subtly.
Throwing away unit tests is like saying "This ship has been sailing for years and has never sunk - let's throw away the lifeboats!"
Now, yes - somebody could erroneously change the test condition to make it pass, although hopefully that kind of change would be spotted by even a cursory code review. You can say the same thing about developers who carelessly suppress compiler warnings without understanding what they're telling them. However, the support is there in case I, or another developer, make a mistake.
FWIW, catching future mistakes is definitely not the only thing for which we use Unit Tests. The problem domain is hard, and for every test fixture we've written we've found at least one bug. Catching and debugging these bugs from the unit test runner is a lot easier than spotting and debugging these kinds of issues at runtime.
- e28eta 13y agoI think it'd be impossible to know which tests haven't failed. What if they failed on a developer machine because he introduced a regression, but it was fixed prior to checkin? Your CI build thinks the test hasn't failed, but instead it was performing an important job. Those tests probably are a good place to start if you think you have useless tests, but it's simply a heuristic.