
Envy subclasses for superclass access
Quote:
>I have been told that Envy can support test automation by providing
>the ability to define a subclass in which all superclass variables are
>visible. This allows a test driver to be implemented as a subclass
>of the class under test.
Envy provides the ability to define an extension of a class. An extension
is essentially a group of methods which can be loaded and unloaded
independently of the class definition. One could implement the test as a
separate application or a subapplication that extends the classes being
tested with methods that perform the tests, but it would be smarter to use a
real testing framework such as the Kent Beck one. The classes and methods
that set up the tests can still be in a separate application--this way, they
can easily be separated before packaging. Finally, in my not so humble
opinion, implementing a test driver as a subclass of the class under test
sounds suspiciosly like the design style of C++ programmers who still have a
hard time realizing that aggregation, collaboration, and inheritance cannot
be freely interchanged for the sake of pleasing the compiler.
--Vassili