简体   繁体   中英

Best approach to integrate testing for Spring, Rabbit MQ, mysql

I want to best appraoch to integration testing for spring, RabbitMQ and mysql, while removing any external dependencies to Mysql and RabbitMQ. I have tried using: 1. Mock test, but it not the ideal integration testing 2. I can use INMD, but its do't the actual replication for Mysql

Please help me!!

Thx, Prikshit

The ideal case senario is to replace MySql By an H2 memory database : if you use Spring you can change the test configuration to reference an H2 memory .

For rabbitMq , my advice is to use a real RabbiMQ : this can be done by using Vagrant with chef for provisioning the RabbitMq and the Vagrant maven plugin to start the Box before Integration tests and halt it in the post phase of integration tests :

The Vagrant Maven plugin : http://nicoulaj.github.io/vagrant-maven-plugin/

Vagrant WebSite : http://www.vagrantup.com/

Cookbook Chef for RabbitMQ : https://github.com/opscode-cookbooks/rabbitmq

To Summarize you must :

  1. Install Vagrant and create an empty Box(Centos or Ubunutu).
  2. provision the VM with rabbitMQ cookbook .
  3. place .box into you home folder (rabbitMQ.box).
  4. Configure you maven Project to start the VM with vagrant up (~/rabbitMQ.box) in the pre phase of integration tests .
  5. Configure you maven Project to stop the VM with vagrant halt (~/rabbitMQ.box) in the pre phase of integration tests .

Hope that this help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM