A
A
Alexey Shashenkov2019-07-19 11:55:36
Software testing
Alexey Shashenkov, 2019-07-19 11:55:36

How are microservices tested for integration?

I can't figure out how to test the service and understand what request the tested service sent to another service, I need to know what data it sent.
I use supertest - I send a request to the service under test, it modifies it and sends it further, the question is how to understand in what form the data flew further. As I understand it, I need something like a mock that will store the last request to myself and I can check it in the test for compliance. I can't find a reasonable example of how to do this. If there is a piece of code or a library to look at, kick me - I'll move on. Thanks to all.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
K
KiT, 2019-07-24
Maverick @kit_de

Nifiga yourself, they advise you to mock services through Virtual Box)))
Here is the npm library for mocking services - it's called nock . With Mocha works on "Hurrah!". This is a faster option.
If you want something super duper powerful, I recommend Pact. This is a harsh and complex software, but it works hard. This option is more difficult.
Here are a couple of links for you to quickly get to the bottom of it:
People, added a link to my repository with a sandbox for the pact. Who wants to quickly understand what the essence is - you are welcome. There is consumer, provider, pact, config for pact broker. For the first time I upload a turnip for the community - star the repository of a young author)

F
fubaro, 2019-07-19
@fubaro

For request tracing, the opentracing standard is used, the implementation is jaeger, zipkin.
To fix the request/response structure, you can use swagger, grpc or simply type it.

5
5am, 2019-07-19
​​@5am

we use an external service for mocks, where you can configure the return of responses to the necessary requests (although the logic has to be written in JS, and this is an amateur of course) and saving all incoming requests / responses in order to get them later through the API and analyze
for example:
https ://getsandbox.com
is not perfect (for half a year - they changed the authorization scheme 1 time => the tests fell off and lay for half a day a couple of times), but our tasks are solved

V
vanyamba-electronics, 2019-07-20
@vanyamba-electronics

The easiest way to do this is with VirtualBox.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question