They are tested in the factory, as per the picture above.
Some that don't work will escape in to the wild but as someone who directs the build of 100's of small microprocessor modules every month I can tell you that mostly they either pass the test or not, and if they pass a small number, a very small number, have a really odd issue that no other tests would of detected. C'est la vie.
I got mine today. No joy with ethernet or keyboard at first and I could see lots of messages in the boot log about being unable to reset the USB bus. For a few moments I thought I might have a duff one. But I tried various combos of USB devices, unplugged ethernet, changed the powersupply and so forth until I discovered that it was the cheap lead from the power to the Pi that was causing problems.
Many other people have reported similar experiences - thought it was all doom & gloom but turned out to be a peripheral issue.
So, message to the world, Pi's are tested and if you have problems, check things out methodically, it's more likely to be what you've plugged in rather than a faulty Pi.