Testing Objects

A class has no concrete realization, and an object is an instance executing in a specific environment. thus it is impossible to do execution-based testing on a class. Only non-execution-based testing, such as an inspection, can be done.

Often methods are used to modify the attributes (or state variables) of an object. These methods do not return a value to the caller. Therefore, the only way to test that the change of state has been correctly performed is to send additional messages to the object.

Even if a method has been adequately tested, the same method may still require thorough testing when inherited, unchanged, by a subclass.

However with proper design the use of the object-oriented paradigm does reduce the need for testing.