[rabbitmq-discuss] integration testing with Rabbit and Java

Dave Syer david_syer at hotmail.com
Fri Oct 29 18:53:22 BST 2010

On Oct 26, 1:54 pm, Shane <sh... at digitalsanctum.com> wrote:
> Anyone have any pointers on how best to do integration testing with
> RabbitMQ, java client, and Spring AMQP?

There are some integration tests in Spring AMQP (look for
*IntegrationTests.java).  We use a JUnit rule to check for a broker
before we start testing.  At the moment this is just a convenient way
to prevent failures in a CI build, but we might extend it to be a
little more subtle (e.g. allow an assertion instead of an assumption
depending on a profile setting).

> I'd also like to know how to easily setup/start/stop more than one
> broker per machine programmatically to test things like failover. Is
> there such a thing as a mock broker?

There *are* some utilities in Spring AMQP for starting and stopping a
broker, but I'm not 100% happy with them yet (hence we don't use them
in our Rabbit integration tests yet).  The main problems are platform
variability (e.g. Windows behaves rather differently than Linux), and
occasional slow start up, which is hard to distinguish from failed
startup.  If you want to try it out and maybe give us some feedback,
or even help out with fixing problems, you can look at
RabbitBrokerAdmin (in the spring-rabbit-admin project).

Someone suggested that maybe JErlang might be usable to launch an
embedded broker for testing.  No-one tried it as far as I know, but
we'd be interested to hear of any experience or opinions on that as


More information about the rabbitmq-discuss mailing list