Monday, July 11, 2011

The Art of Software Testing by Glenford Myers : Chapter 3

The author introduces non-computer based or human testing in this chapter. Methods related to this kind of testing are applied between the time the program is coded and the time the computer-based testing begins. This provides two advantages:
  • The errors are found earlier in the development cycle and the cost of correcting them is lesser and the probability of correcting the error correctly is higher.
  • While correcting the errors found during computer-based testing, the programmers are under immense pressure forcing them to make more mistakes.
The author then discusses about similarities and differences between code inspections and walkthroughs. The author provides several points that work in favour of this processes:
  1. They involve people including the author and so the program is tested not just by the author but by others.
  2. The errors found using these processes result in lower debugging costs since the precise nature of the error is located while computer-based testing only exposes symptom of an error.
The authors specifies that modifying a program is a more error-prone process than writing a new program and so program modifications should also be subjected to these testing processes.

The author then discusses about code inspections, the breakup of the team, the roles people play and the general procedure. There are two main parts:
  1. The programmer is requested to narrate statement by statement the logic of the program.
  2. The program is analyzed with respect to a checklist of historically common programming errors.
The author provides the ideal time for the sessions to be between 90-120 minutes. The author emphasizes on the programmer being open-minded to make the whole process effective. Code inspection identifies the error-prone sections of the code and allow to focus more on that area when computer based testing begins.

The author then provides a common checklist for code-inspection:
  1. Is an uninitialized variable referenced?
  2. Is array subscript value within the defined bounds?
  3. Is array subscript an integer value?
  4. Is the lifetime of reference variable within the lifetime of referenced storage?
  5. If a data structure is referenced in multiple procedures or functions, is the structure defined identically in each procedure.
  6. When indexing into a string, are the limits of the string exceeded?
  7. Are there any "off by one" errors in indexing operations or in subscript references to arrays?
  8. Are there any variables with similar names?
  9. Verify mixed-mode arithmetic correctly.
  10. Verify different size same data type arithmetic correctly, i.e. long with short.
  11. Verify divisor not becoming zero in division operation.
  12. For expressions with more than one operator, are the assumptions about precedence of operators and order of evaluation correct?
  13. Are operands of a boolean operator boolean?
  14. Will every loop always terminate?
  15. Have all files been opened before use?
  16. Are end-of-file conditions detected and handled correctly?
  17. Are I/O error conditions handled correctly?
The author then discusses code walkthrough. The author describes the participants and their role in walkthrough process. The author then describes the difference in walkthrough from code inspection, i.e. the participants execute the set of paper test cases mentally. The comments of code walkthrough should be targeted towards the program and not the programmer. The rest of the process follows that similar to code inspection.

The author then discuss about desk checking and tells that it is not as effective as code-inspection of walkthrough.

The author then talks about peer ratings. The participants are told to evaluate anonymous programs in terms of their overall quality, maintainability, extensibility, clarity and readability. The participants are asked to rate the programs on a scale of 1 to 7 in terms of different questions such as:
  • Was the program easy to understand?
  • Would it be easy to modify this program?
  • Would you be proud to have written this program?

No comments:

Post a Comment