For a very simple computer program, we can write code, then run it, entering a variety of valid and invalid data, and see whether the program behaves as we expect it to. This is known as a code-then-test approach. However, this approach has several significant weaknesses:
- Each time we change the code, as well as running new tests relating to the code we are improving, we have to run all the old tests to ensure that no unexpected modified behaviors have been introduced (in other words, our new code has not broken another part of our program)
- Running tests manually is time consuming
- We are relying on a human to rerun the test each time, and this test may be run using different data, or some data may be omitted, or different team members may take a different approach to running tests
Therefore, even for simple programs (and most are not simple), some kind of fast,...