4 ms·
Can confirm. Recently had simple unit tests that almost seemed, on first glance, to indicate, “huh, why are these tests here?” Upgraded to NodeJS 12 where some
by karmelapple 5y ago
Can confirm. Recently had simple unit tests that almost seemed, on first glance, to indicate, “huh, why are these tests here?”
Upgraded to NodeJS 12 where some details about sorting arrays were changed, and we got 2 failing tests. Before that, I would have bet money that those tests would never fail.
- astrange 5y agoWas that the point of the tests, or just a coincidence? Now that they've failed once they've become regression tests (one of the most useful kind of test), but if you set out wanting to test the platform under you I think you'd want to do a lot more work than that.
- karmelapple 5y agoI might be missing the question - are you asking if the point of the tests was to check that it would work when we upgrade a version of NodeJS? The point of our tests was to document a requirement we had - in this case, how some data sorted. That test was able to eliminate questions of the "how" - whether the sort was done in our database layer or our NodeJS layer - and let us focus on the important outcome: are the things sorted in the right way? We didn't write them because of the NodeJS 12 upgrade. We wrote them 5 years ago. We added them because writing them captured a requirement. And when an unexpected reason caused that functionality to break, we avoided shipping a bug in our software. Regression tests are certainly useful, and every time we ship a bug, we attempt to write an automated regression test. But I wouldn't argue they're one of the most useful - equally useful is any test that captures a requirement.