Envy subclasses for superclass access 
Author Message
 Envy subclasses for superclass access

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.

I would like to describe this approach in my forthcoming book
on OO Testing, giving an example.

Any comments on this as a testing approach?  Code examples?

Tia
______________________________________________________________________________
Bob Binder                 http://www.*-*-*.com/          RBSC Corporation
312 214-3280  tel         Software Engineering         3 First National Plaza
312 214-3110  fax         Process Improvement          Suite 1400



Wed, 18 Jun 1902 08:00:00 GMT  
 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



Wed, 18 Jun 1902 08:00:00 GMT  
 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.

Thanks for this making this clear.

Quote:
>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.

I'm pleased to see that at some Smalltalk developers still believe
God is on their side ;-)

______________________________________________________________________________
Bob Binder                http://www.rbsc.com          RBSC Corporation
312 214-3280  tel         Software Engineering         3 First National Plaza
312 214-3110  fax         Process Improvement          Suite 1400



Wed, 18 Jun 1902 08:00:00 GMT  
 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

[Snip]

Quote:
> but it would be smarter to use a
>    real testing framework such as the Kent Beck one.

Yes, of course -- this question arises in the context of developing patterns
that document exactly such a framework.  The essential problem (not limited
to Smalltalk) is how to achieve sufficient controllability and observability
of the class under test when the implementation is encapsulated.  This problem
must be solved (or tolerated) regardless of the test framework used.

[snip]
______________________________________________________________________________
Bob Binder                http://www.rbsc.com          RBSC Corporation
312 214-3280  tel         Software Engineering         3 First National Plaza
312 214-3110  fax         Process Improvement          Suite 1400



Wed, 18 Jun 1902 08:00:00 GMT  
 Envy subclasses for superclass access

Quote:

>Yes, of course -- this question arises in the context of developing patterns
>that document exactly such a framework.  The essential problem (not limited
>to Smalltalk) is how to achieve sufficient controllability and observability
>of the class under test when the implementation is encapsulated.  This problem
>must be solved (or tolerated) regardless of the test framework used.

Easy. The test framework should be able to break encapsulation. Encapsulation
is a mechanism for program organization. There are clearly reasons that
particular systems may need to violate it in a disciplined way, e.g. testing,
persistence. In Smalltalk this is possible through using the reflective
mechanisms. Java didn't used to have this, and they found they needed it, q.v.
the changes to the security mechanism in JDK 1.2.

--

The Object People                       http://www.objectpeople.com                  
613.225.8812(v) 613.225.5943(f)    



Wed, 18 Jun 1902 08:00:00 GMT  
 Envy subclasses for superclass access

Quote:



>>Yes, of course -- this question arises in the context of developing patterns
>>that document exactly such a framework.  The essential problem (not limited
>>to Smalltalk) is how to achieve sufficient controllability and observability
>>of the class under test when the implementation is encapsulated.  This problem
>>must be solved (or tolerated) regardless of the test framework used.

>Easy.

Care to elaborate?


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Envy subclasses for superclass access

2. How to copy a subclass from a superclass?

3. Changes in superclass are not reflected in subclasses.

4. Invoking a subclass's method on its superclass's instance

5. ENVY: Application with different superclass?

6. Using methods in the superclass' superclass

7. jython question: accessing protected superclass methods

8. access to a shared variables of a subclass?

9. To Subclass or Encapsulate? (WAS: Access Methods)

10. Accessing envy behind a firewall

11. VW:Envy:Remote access

12. How exporting Parcels From Envy For Non-Envy

 

 
Powered by phpBB® Forum Software