Ah, the code coverage myth.
That assumes all tests are good tests, and that all requirements are good requirements, and that nothing is implicit.
In reality, such coverage testing often includes tests that don't really test anything. Especially related to failure modes; failure to enumerate all possible faults is a very common problem. I've never been involved with a project that had complete and absolutely correct requirements.
It also assumes perfect segmentation. That's something a single very good developer can design in, but it is never realized in practice with a team.
Exhaustive testing means you know every line of code works. Coverage tools give you the illusion that you have that. They are the best we have, but it is still far short of exhaustive testing.
As a systems engineer -- not just a software engineer -- the system must work as a whole for its intended purpose. This means you can find faults in requirements and in the associated tests as well. No coverage testing tool will uncover those.
Well if you write crap tests then yeah you're gonna have worthless testing. Garbage in, Garbage out.
It's also amazingly difficult to write software to a moving target, and any developer that has been in the industry more than a minute can tell you that the powers that be change their mind with the wind and often vast swaths of previously required critical code just went out the window.. to include the exhaustive tests which likely will be a little less exhaustive on the next go around because again, they dont' want to pay for testing..
No client does.. And most product managers don't want to fight that fight with the client so they don't want it either..
I was an IBM engineer for 6 years and was given the "write it correctly the first time" speech more than once because they saw testing as a waste of time and money.
Having said that if you have a good standard, and your people follow it.. you can get excellent code coverage whether you think you can or not. That code coverage though tests the language and the classes, objects, methods and functionality internally so that you get out of model or controller what you expected to..
People being people though, you need someone to monitor the tests to make sure that they are written correctly which again, is rarely paid for. And no testing isn't infallible, but it's a damn site better than having no testing at all which I can tell you from experience is exactly how much many large companies have..
Frankly, I find the best kind of testing also involves a warm body trying to make the code break. But again, they dont want to pay for that and IBM, Dunn & Bradstreet and a few other major companies I worked for would outsource that stuff to China and India where amazingly everything always worked! Even when we wrote intentional bugs into the code..
You get what you pay for.. and I always tell my clients, with testing it's to help find breakage.. and you will pay for that, one way or the other.. All too often I think companies just go light on it and hope they don't get sued.