17 ms·
These are known algorithms you're talking about, the one place where unit tests actually consistently make sense. I'm not writing a math library, however. I'm w
by joesmo 11y ago
These are known algorithms you're talking about, the one place where unit tests actually consistently make sense. I'm not writing a math library, however. I'm writing APIs and web GUIs. We have an immense amount of business logic and we do unit test a lot of it, but as I mentioned above, those unit tests hardly ever catch any bugs and they take a lot of time to maintain. Every time there's a change in the logic, the tests have to be updated. 999/1000 times, when a unit test fails after a chance it's because it needs to be updated, not because there is a bug. Keeping up with those updates is simply not worth the time to catch one bug per year. Neither is writing new unit tests in these areas. Writing them for well-defined algorithms with a limited (or at least definable) set of known inputs and outputs, as I mentioned in my original reply, is still useful. Other types of testing that our developers could do to make sure the code is high quality are much more useful of course and therefore preferred because they actually help make the codebase better rather than creating the illusion of doing so as unit tests often do.
- githulhu 11y agoI don't use tests, and I find that when I need to make a change to some code that has, say, four or five different paths through the logic, a lot of times one of the paths will break. Testing all of the paths manually each time there is a change is incredibly tedious and time-consuming. I feel like if I had unit tests I would be able to just see instantly if anything was broken. But, I never can seem to find the time to write them...
- girvo 11y ago> 999/1000 times Gosh I love made-up numbers, don't you? I've had unit tests just these past few weeks catch bugs within our Redux logic flows, from Action Creators. We have to ship this app next week. Guess what would've happened if I hadn't written those tests? Now, the thing is I actually agree with you; as does nearly everyone who's replied to you here: Unit tests are not a panacea, and they really shine when as a part of a full test-suite that covers interaction, functionality, integration and more. Of course, this is why any decent testing framework gives you those abilities as well... You're disagreeing with an argument that no-one has put forward, from what I can see.