H
H
hellboy19812015-05-28 18:15:36
Software testing
hellboy1981, 2015-05-28 18:15:36

How to properly test microservice interactions?

There is a ready-made service A, which should use the not yet implemented functionality of service B.
-
- How can / should the functionality of B be simulated? My answer: using the nok library (what else?)
-

  • Should/is it possible to write functionality in A before implementing B? My answer is yes
  • How to test this functionality if there is no B? My answer: With the help of integration tests.
  • How to test when B is already implemented? Using the same integration tests, but replacing the call with a real one?
  • Testing takes place on the developer's local machine (localhost). All services use the same port. How to deal with port conflicts? Can I manually change the port number (which is bad)? Can I run a second service on a different machine?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur Shemsedinov, 2015-05-28
@hellboy1981

All this is done with the help of stubs, which instead of the implementation give plausible data, just hardcoded. Services, be they even SOA, even microservices, they should not be tied to ports at all. A service is a facade that closes the implementation of server logic from the outside world; when it starts, the service takes the port, host, access addresses to other services, and any other parameters from the settings. In order to start several services on one machine, simulate a server environment, several servers, you can use docker containers or virtual machines. From different ports, services can be combined into one bundle using nginx or another reverse proxy with URL rewriting. Or there is an option to use an application server, which hides from the developer the task of launching and combining services into one bundle.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question