Testing API integrations

Andrii Bosonchenko
1 min readJan 7, 2022

…with github.com/andboson/http-echo-logger

Let’s consider how to run E2E tests API integration using only the local environment.

For instance, we have an order processing system and an external warehouse system.

System diagram

We have to check how does the integration between these two system work.
The Warehouse system is not fully deployed yet.

But we have API documentation and our work for the integration is completed and successfully tested.

Let’s check if our Order system correctly posts requests and can process responses from the Warehouse service.

docker-compose.yml with our service and docker-container with mock-server:

version: '3.8'
services:
request-logger:
image: andboson/http-cli-echo-logger
ports:
- "8888:80"
environment:
CUSTOM_ENDPOINTS: |-
/graphql::{"data":{"products":{"edges":[{"node":{"product":{"id":"1077","ref":"JAR-01","quantity":99}}}]}}}
/oauth/token::{"access_token":"33f2b5a7-8341-46b5-92c8-9eeecf4f4ae3","token_type":"bearer"}
order-service:
build:
dockerfile: Dockerfile
context: .
ports:
- "8080:80"

Here we have two endpoints with some mock response data

Now we can make curl-request to our service and see logged requests in the mock-server logs (or with HTTP interface)

In the same way, we can test publishing to AWS topics (with http-subscription), etc

--

--