Unit Testing
摘要
As was emphasized in the last chapter, nobody is perfect, including software developers. In Chapter 17 , we talked about different things to look for when you know there are errors in your code. Now we’re going to talk about how to determine whether there are errors. Of the three types of errors in your code, the compiler will find the syntax errors and the occasional semantic error. In some language environments, the runtime system will find others (to your users’ chagrin). The rest of the errors are found either through testing or through code reviews and inspections. In this chapter, we’ll discuss testing: what it is, when to do it, how to do it, what your tests should cover, and the limitations of testing. The next chapter will cover code reviews and inspections.