View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Question 4(Testing)

4. (20) Testing

(a) (4) Explain why practitioners of eXtreme Programming believe that a test suite should be written before a class is implemented.

A test suite effectively defines a contract for services.
In more detail:

Half-credit for an answer that describes why a test suite is useful but doesn't make the XP-related points above about why it should be written first.

(b) (8) Briefly describe one advantage and one disadvantage with regard to testing of the encapsulation provided by objects.

Advantage (4 points):
Because encapsulation enforces information hiding, undesirable dependencies between client and server classes are avoided. In particular, the implications of changes are restricted, thus simplifying testing after changes (regression testing).
In general, this answer should include something about encapsulation helping the user to avoid certain kinds of errors, thus making testing easier.

Disadvantage (4 points):
Encapsulation hides the states of an object, which must be manipulated in the testing process. Although encapsulation does not directly introduce faults, it may be an obstacle in testing by reducing controllability and observability.
In general, this answer should discuss how the testing process is made more difficult by the same attributes of encapsulation that make some kinds of errors less likely.

(c) (8) When implementing and testing a subclass of a parent class that is already considered “tested,” under what circumstances would it be necessary to retest some (or all) of the methods of the parent?

The general concept is that any situation where the existence of the subclass might make the parent class methods act differently must result in some additional testing of the parent class.

Link to this Page