[Seaside] ShoreComponents test cases -- worth doing?

David Shaffer cdshaffer at acm.org
Sun Jul 17 20:38:48 CEST 2005


I've started looking at writing tests for the ShoreComponents (the name
is fine for me, by the way).  One problem I've been having is the
"canBeRoot" check.  In SeasideTesting components that don't answer
"true" to this method can still be the root of a "test" application. 
ShoreComponents breaks this with:

ShoreComponent>>new
    "Returns a new instance of the receiver"

    self canBeRoot
        ifTrue: [ ^ super new ]
        ifFalse: [ self error: 'use parent:'. ].   


This makes writing a test case for any ShoreComponent very
inconvenient.  It seems to me to be more of a "self check" rather than a
necessity.  I understand that some components _require_ a parent but
this is independent of the #canBeRoot mechanism (which, despite its
name, is really just a flag to make the config tool's list shorter). 
So, rather than me hacking a workaround into SeasideTesting would you
consider adding #mustBeChild to the class side of ShoreComponent
(default to false) and check it instead of canBeRoot.  That would, of
course, mean that you'd have to go through and pick the components that
require a parent and set their #mustBeChild to true.  Of course this is
only reasonable if most components don't actually require a
parent...which I assume they don't.  If I'm wrong here then I'd be happy
to hear other suggestions.

David



More information about the Seaside mailing list