You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Fraser Adams <fr...@blueyonder.co.uk> on 2013/10/31 19:06:55 UTC
qpid::messaging mocking Connection etc.
Hi all,
A colleague of mine is writing some client code and he wants to do the
right thing by putting together unit tests around his client. He asked
me about mocking Connection and to be honest I couldn't give him a good
answer.
I took a look at the qpid::messaging code and noticed the
ProtocolRegistry code and my guess is that it would probably be possible
to write mock classes and use this mechanism to register factories for
them and have qpid::messaging::Connection use that as a concrete class -
from quickly looking at the code this seems to be the way that the AMQP
0.10 and AMQP 1.0 concrete implementations are selected, so that all
seems plausible.
Unfortunately however my colleague is stuck on Qpid 0.18 and I'd guess
that the ProtocolRegistry code is a lot more recent, probably put in to
support AMQP 1.0, so probably Qpid 0.20 at the earliest.
So my question really is: has anyone looked at doing pure unit tests of
qpid client code and if so what approach have they taken to mocking out
implementation code - I'm particularly interested in 0.18, but I guess
if anyone has thought about it for more up to date releases that'd still
be useful.
MTIA,
Frase
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: qpid::messaging mocking Connection etc.
Posted by Alan Conway <ac...@redhat.com>.
On 10/31/2013 02:06 PM, Fraser Adams wrote:
> Hi all,
> A colleague of mine is writing some client code and he wants to do the right
> thing by putting together unit tests around his client. He asked me about
> mocking Connection and to be honest I couldn't give him a good answer.
>
> I took a look at the qpid::messaging code and noticed the ProtocolRegistry code
> and my guess is that it would probably be possible to write mock classes and use
> this mechanism to register factories for them and have
> qpid::messaging::Connection use that as a concrete class - from quickly looking
> at the code this seems to be the way that the AMQP 0.10 and AMQP 1.0 concrete
> implementations are selected, so that all seems plausible.
>
> Unfortunately however my colleague is stuck on Qpid 0.18 and I'd guess that the
> ProtocolRegistry code is a lot more recent, probably put in to support AMQP 1.0,
> so probably Qpid 0.20 at the earliest.
>
> So my question really is: has anyone looked at doing pure unit tests of qpid
> client code and if so what approach have they taken to mocking out
> implementation code - I'm particularly interested in 0.18, but I guess if anyone
> has thought about it for more up to date releases that'd still be useful.
>
There aren't any "pure" unit tests in the C++ qpid test suite for the messaging
API. Instead the "unit" tests use the BrokerFixture, which can start a broker in
the unit test process, rather than as a separate qpidd process. Have a look at
qpid/cpp/src/tests: BrokerFixture.h, MessagingFixture.h and
MessagingSessionTest.cpp if you're interested in that approach.
Cheers,
Alan.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org