From: Steve Freeman <steve@m3...> - 2003-06-12 21:02:07
Someone else's framework, right? You're not going straight to the
abstract class? :-o
One option would be to wait until you have a need for a concrete
sub-class and then test through that. Once you have two or more of these
you can factor out the common testing (i.e. the bit which is implemented
by the abstract parent) into a helper test class and use that in the
tests for the concrete classes. You still have to test the subclasses
and the helper tests will support you, or whoever else is using the
framework, to write their own tests.
Otherwise, sure. If the abstract class is already defined, then you can
use the expectation library to help you construct a concrete subclass
for testing. Whatever works. I'm not sure I'd call it a Mock, but I'm
not sure that matters.
Dan Cramer wrote:
> It's part of a framework, and is the AbstractClass part of a Template
> Method [Gof 325].
> My goal is to test that the sequencing of method calls is correct, and I
> was just wondering if a Mock sub-class is the way to go.