>  represent a bloc of coherent behavior that can be parametrized. Load the
> latest Collection-Tests from the
>  pharo source. This is just the start but this is quite cool. Check
> TEmptyTest. It is applied to
>         OrderedCollection, Basg, Set, Array, Interval (and could be to
> others too).

I wonder what the advantages of using Traits over creating a test
class hierarchy mirroring the collection hierarchy is?

Normally the tests in TEmptyTests should be valid on all collections
and should thus be run automatically on all subclasses of Collection.
If you would put these test methods in CollectionTest you would have
the same result, ensuring that all subclasses satisfy the contracts of
Collection.

I think it is too easy to forget to add TEmptyTests to a new test
(especially if there are many such traits). And if somebody
intentionally avoids adding TEmptyTests, then he probably shouldn't
have subclassed Collection at all.

I successfully use test hierarchies in Magritte and Pier from the very
beginning. This allows me to specify exact contracts in the (abstract)
superclasses that are then automatically checked on all its
subclasses. OB-RB has functionality to ensure that both class
hierarchies are identical.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to