[squeak-dev] Subclassing tests Style Question

Herbert König herbertkoenig at gmx.net
Mon Jul 21 06:05:56 UTC 2008


Hi,

I have two classes say A and B.

B has a collection of A which is quite complex.

Laziness suggests to make BTests a subclass of ATests so I could reuse
the (lengthy) setUp of A in A tests. Something like

BTests>>setUp
 super setUp
 ..stick a copy ATests A into BTests B
 super setUp
 ...add a slightly modified copy of ATests A into BTests B

The gut feeling says BTests should not inherit from ATests if
B does not inherit from A.

But copying all that A setup code from ATests to BTests does not seem
right either.

Hey that's the first time I think using a Trait might not be that
bad??

Making a class with the only purpose to return initialised instances
of A??

Any advice is much appreciated!


Thanks,

Herbert 




More information about the Squeak-dev mailing list