jeudi 26 avril 2018

Spring microservice end-to-end testing

I'd like to write a end to end test for a pipeline, built with spring boot.

Consider two microservices A, B where B consumes output from A and produces a RESTful API. They are connected using rabbitmq and rely on an external database.

System scheme

I would like to achieve something like:

  1. Create a new project that includes both microservices
  2. Create a test configuration that configures JPA provider to be an in-memory database
  3. Inject custom MQ into A, B to connect them (rabbitmq is not tightly coupled)
  4. Write tests

Essentially replacing the white parts with mocks and testing the coloured parts.

Does this make sense? Test coverage of A and B is not complete and such a test would guarantee that the contract between A and B holds. Are there better ways?

Aucun commentaire:

Enregistrer un commentaire