Skip to content

Files

Latest commit

9c9f53d · Dec 4, 2024

History

History
53 lines (37 loc) · 1.78 KB

README.md

File metadata and controls

53 lines (37 loc) · 1.78 KB

MockServer

  • Mocks integrated systems via HTTP or HTTPS:
    • Configure it to return specific responses for different requests.
    • Can be used as a proxy to record and optionally modify requests and responses.
    • Can be both of the previous ones.

Infographic of MockServer

For each request received the following steps happen: first. find matching expectation and perform action. If no matching expectation proxy request if it is configured to act like a proxy request. Otherwise return 404

With MockServer we can:

  • Return a mock response when a request matches an expectation.
  • Forward a request when the request matches an expectation.
  • Execute a callback when a request matches an expectation (dynamic mocked response).
  • Return an invalid response or close the connection when a request matches an expectation.
  • Verify requests have been sent.
  • Retrieve logs, requests or expectations to help debug.

Proxying

We are doing this for integration and e2e tests.

Important

HTTP client should send requests to the MockServer. Not the actual service.

GUI

You can see logs, active expectations, requests received, proxied requests in the dashboard. Open this address in your browser: localhost:1081/mockserver/dashboard

SSL

MockServer can present a valid X.509 Certificates for any hostname.

Compose

services:
  mockserver:
    image: mockserver/mockserver:5.15.0
    restart: on-failure:3
    ports:
      - 1081:1080

Read more