HackerNoon.com
Published in

HackerNoon.com

How to test Microservices with Consumer-Driven Contracts?

Benefits of Monolithic architecture

  • Single codebase — simple to develop (at least in the beginning).
  • No need to verify integration with other services since they don’t exist.
  • Relatively easy deployment process — only one service needs to be deployed.
  • Single point of failure — if one app is down, the whole service is down.
  • Maintenance complexity grows with time.
  • Hard to adapt new technologies and techniques. Usually it requires rewriting the application from scratch.

Benefits of Microservices

  • No single point of failure. When one service is down users can still use the application. Other services are still working.
  • Individual Microservices can be scaled up to increase their capacity and availability.
  • Security — most of the services aren’t exposed to the Internet.
  • Every service can be deployed independently of other services. Providing they don’t break the API contracts.
  • Lots of work need to be invested to setup the foundation.
  • Deployment processes are more complex. Some deployments may require deploying more than one service.
  • Tons of work on DevOps. Especially with deployments…
  • Dealing with integration testing.

Designing Microservices for the Job Posting application

How to deal with testing?

Consumer-Driven Contracts

How it works?

What tools to use?

What is a consumer?

What is a provider?

Hold on a second… so, how to deliver contracts to all peers?

  • a Git repository for storing pacts, and including them into each project with a git submodule. In my opinion the best way of doing it,
  • a file system.
  • the Pact Broker.

Why not Swagger?

Summary

--

--

Elijah McClain, George Floyd, Eric Garner, Breonna Taylor, Ahmaud Arbery, Michael Brown, Oscar Grant, Atatiana Jefferson, Tamir Rice, Bettie Jones, Botham Jean

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store