Testing philosophy
A key element of everything involved with testing is another question: Why test? What are we trying to achieve with it?
As we've seen, testing is a way of ensuring that the behavior of the code is the expected one. The objective of testing is to detect possible problems (sometimes called defects) before the code is published and used by real users.
There's a subtle difference between defects and bugs. Bugs are a kind of defect where the software behaves in a way that it's not expected to. For example, certain input produces an unexpected error. Defects are more general. A defect could be that a button is not visible enough, or that the logo on a page is not the correct one. In general, tests are way better at detecting bugs than other defects, but remember what we said about exploratory testing.
A defect that goes undetected and gets deployed into a live system is pretty expensive to repair. First of all, it needs to be detected...