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-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org