Juval Löwy wrote:The sad reality is that unit testing is borderline useless. While unit testing is an essential part of testing, it cannot really test a system. ... The inefficacy of unit testing is not a new observation and has been demonstrated across thousands of well-measured systems
Juval Lowy wrote:Breathing is essential and important, but where is the added value? ... Brushing teeth in the morning is essential. But you do not take too much pride in doing that task?
Even if all components passed unit testing 100% it means nothing to the quality and correctness of the system.
(The book explains why) unit testing cannot really test a system (the defects are in-between the components)
why developers focus on unit testing, because it is the only kind of testing that is possible in a functionally-decomposed system (searching under the street light).
Grey Smith wrote:I don't know if we should really call unit tests "tests," because it implies that they exercise the code. I've found dozens of bugs by manual testing and reading code, and probably less than ten from unit tests.
Grey Smith wrote:I consider unit tests important because they implicitly ask developers to write simple, short code that has a small number of readily understandable dependencies. If it's difficult or cumbersome to write a unit test, it's strong evidence that there's something wrong with the code being tested (or the dependencies of that code or of the test code), and developers should immediately fix that, rather than add layers of complexity to a unit test. Of course, if developers don't have this mentality or don't understand how to improve their code, then unit tests are a waste of time, and conversely (though far more rarely), if code is written well enough to start out with, then unit tests won't promote any changes to the source code, which removes most of their utility.
In theory, you could perform regression testing even on a functionally decomposed system. In practice, the complexity of that task would set the bar very high. The sheer number of the functional components would make testing all the interactions impractical. The very large services would be internally so complex that no one could effectively devise a comprehensive strategy that tests all code paths through such services. With functional decomposition, most developers give up and perform just simple unit testing. Therefore, by precluding regression testing, functional decomposition makes the entire system untestable, and untestable systems are always rife with defects.
Juval Lowy wrote:Same is true for unit testing. You are not hired because of your unit testing. Ever. You are hired to add value to customers.
Grey Smith wrote:If you're referring to integration (automated) tests -- my experience is remarkably different. I've worked on several projects with minimal bugs and no integration tests, because developers religiously practice manual testing and code reviews.