[squeak-dev] Re: Subclassing tests Style Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Subclassing tests Style Question

Jerome Peace
[squeak-dev] Subclassing tests Style Question


Would factoring out an AFactory class help both ATests and BTests?
If so I would go with that.  
It sounds like that would also become useful in the future use of A.

Then the A setup and the B setup would be both be simple things.

Hth,

Yours in curiosity and service, -Jerome Peace

***

>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
>
***