0

I am new to microservices and I have some issue about testing chain of services. my application developed in spring boot and contains three services as below (each service is a independent spring boot application):

enter image description here

user ask a resource from service A, service A process the request then send it to service B,service B process the request then send to service C. service C finally send a request to third party and as the flow returns response to user.

My problem is to test this flow (chain of services). I know there is spring cloud contract for this requirement.but as I understood, spring cloud contract test just two services(producer and consumer,here service A and B for example). also I can deploy this services in staging environment and test this chain, but I don't want to do this.

Is there any way to perform test in this chain?

mahdieh
  • 156
  • 3
  • 13

2 Answers2

1

To make this kind of test you should to use an end-to-end testing strategy using :

  1. cypress as end-to-end framework
  2. use docker (docker-compose) to run services automatically
  • If you want to start a test from a service not from frontend app you can use [cucumbe](https://cucumber.io/) r as a framework – El Merrouni Jun 24 '20 at 08:16
0

There are so many issues to tackle here.

First such an end to end test -depending on the complexity of the overall system-could be overly complicated and quite costly for long term if not impossible. Not only in terms of initial setup of environment and implementation but more on maintenance of the environment. That is why I would say using "staging" might be your best bet. As that environment would be somehow maintained in terms of configuration changes, versioning, third party dependency management etc.

Having said that if your system is quite complex and it is not possible to setup a reliable staging environment then I would suggest to rely on contract testing plus your internal unit/integration/component test and using "production" testing with proper service versioning plus usage of "feature toggles". you can find some explanation of feature toggles here https://blog.codecentric.de/en/2019/02/feature-toggles-benefits-drawbacks/ and here for versioning Microservice Versioning

cool
  • 1,746
  • 1
  • 14
  • 15