4 ms·
Without tests, how do you know your code actually does what you think? Run it and manually click through every type of functionality? And without tests, how do
by snovv_crash 4y ago
Without tests, how do you know your code actually does what you think? Run it and manually click through every type of functionality?
And without tests, how do you know if you introduced a bug or not? Send it to QA and wait for a week?
- raverbashing 4y agoBecause it runs? And people are using it? Do you really think most code out there is fully end-to-end tested automatically? Having integration tests are a good idea. Mandating TDD dogmatism and selling unit tests as the only type of test acceptable is what's wrong here
- endofreach 4y agoIt‘s the classic „what came first“ question that everybody knows. What was written first: A. Unit tests B. Binary code (The answer might shock some of you…) -
- snovv_crash 4y agoThere are studies on the effectiveness of unit tests (and other layers of tests) from the 1980s. Unit tests catch about 20% of bugs. Integration tests catch 40% of bugs, but the overlap between the two is small, so you still benefit from having both. Which one came first is irrelevant, the question is if they help us write better software.
- endofreach 4y agoThat is an interesting fact, thank you. My point was a different one - and not a serious one… but anyway. Thanks for the stats!
- snovv_crash 4y agoI agree that integration tests are more important, but a lot of components (particularly anything mathematical or with a functional design) benefits hugely from unit tests. For example, checking that your backoff works correctly in the case of dropped packets is really hard to do at a higher level, because that part of your API isn't exposed publicly but is still critical to the correct function in degraded environments. The people who insist on unit tests for 1-line functions are crazy and dogmatic though, I agree. But if a large fraction of your codebase is 1-line functions I'd also argue your architecture is crap. A codebase where effective unit testing is useless or difficult is a distinct smell.