Problem 1
In your own words, describe the difference between white box and black box testing. Why is each important and necessary?
Problem 2
Why do you think unit testing is usually conducted by the developer who implemented the unit?
Problem 4
Explain why testing every line of code for correctness (i.e., 100 percent statement coverage) is generally insufficient for ensuring that a program is bug-free. Give an example of a defect that can go undetected by tests that have 100 percent statement coverage.
Problem 5
Why is path coverage a stronger form of testing than statement coverage? Give an example of a defect that would be detected by path coverage but not by statement coverage.
Problem 7
Write the code for a class Account with attribute balance, accessor methods, and method add(). Assume that Account has states Sound, Empty, and Arrears, and that these are implemented using the State design pattern. Write a complete set of unit tests for Account, including state-oriented tests.
Problem 8
In test-first development, why is it important to execute a unit test to ensure that it fails before the code it is testing is actually written?