qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Godfrey <rob.j.godf...@gmail.com>
Subject Re: Mock/TestableObjects in the JUnit tests
Date Tue, 28 Apr 2009 13:25:23 GMT
In general I think we need test to interfaces rather than
implementations.  Of course this requires us to clearly define the
public interfaces of classes.
I am always disturbed when the act of writing a test causes the
implementation to change to accommodate the test - it's clearly an
indication that something is wrong.   I *hate* extending real
implementations to make test classes - it only ends up with finding
lots of bugs in the test objects and nothing in the actual code.

The fact that we can't unit test individual classes in isolation would
seem to point to errors in our design more than anything else.

-- Rob



2009/4/28 Aidan Skinner <aidan@apache.org>:
> On Tue, Apr 28, 2009 at 9:44 AM, Martin Ritchie <ritchiem@apache.org> wrote:
>
>> Having a common base class for the Java broker tests like we do with
>> QpidTestCase in systests would be a good change.
>
> I'm not proposing having a common base case (and I'm not sure what
> that would give us), it's about having something like
> TestableMaker<Class T> and passing in AMQMesage to that instead of
> having MockAMQMessage. The new TestableAMQMessage would then magically
> expose the relevant bits and add the two constructors.
>
> - Aidan (who realises MockAMQMessage is a really bad example since it
> actually extends AMQMessage and isn't really a Mock at all)
>
> --
> Apache Qpid - Give me convenience or give me death
> http://qpid.apache.org
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
>
>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Mime
View raw message