I’ve sort of padded around the edges of Traits, and decided to reread the 
papers and better understand them.

One thing that occurs to me - if you want to test your traits, is the only 
suggested mechanism to test them in-situ with the classes that use them OR can 
you poof one up and test it by explicitly pumping in something that would 
represent “self” in its usage?

Or is this the wrong question - and would you view Traits as a refactoring 
exercise - so you write tests for a concrete class first - and then extract 
them into a Trait keeping the tests running?

This has the thorny side effect - which like inheritance, means that ultimately 
you have to test a BaseClass with all its concrete subclasses (so do you have 
to do the same with traits? As you may have overridden something you didn’t 
intend?).

I thought maybe the paper - “Reusing and Composing Tests with Traits” might 
discuss this angle, but it doesn’t cover it.

Any thoughts/pointers?

Tim

Reply via email to