Slide 1

Slide 1 text

GopinathLangote Confidently Releasing Microservices With Consumer Driven Contracts Software Engineer

Slide 2

Slide 2 text

Confidently Releasing Microservices With Consumer Driven Contracts

Slide 3

Slide 3 text

Confidently Releasing Microservices With Consumer Driven Contracts

Slide 4

Slide 4 text

Confidently Releasing Microservices With Consumer Driven Contracts

Slide 5

Slide 5 text

Confidently Releasing Microservices With Consumer Driven Contracts Client / Consumer Server / Provider

Slide 6

Slide 6 text

Confidently Releasing Microservices With Consumer Driven Contracts

Slide 7

Slide 7 text

Payments Team Growth Team Problem Statement

Slide 8

Slide 8 text

Refactoring

Slide 9

Slide 9 text

Unit Tests Mocked Integration Tests Functional Tests Manual Tests Test Pyramid

Slide 10

Slide 10 text

Unit Test Limited to method level Not aware of other service Trustworthy

Slide 11

Slide 11 text

Mocked Integration Test

Slide 12

Slide 12 text

Mocked User Service Not aware of other service Changes No Feedback Loop Trustworthy Mocked Integration Test

Slide 13

Slide 13 text

Real User Service Time Consuming Longer Feedback Loop Trustworthy Functional Test

Slide 14

Slide 14 text

Manual Test

Slide 15

Slide 15 text

Unit Tests Contract Test Functional Manual Tests Test Pyramid

Slide 16

Slide 16 text

Account Service Consumer Service Contract Test User Service Producer Service Payments Team Growth Team

Slide 17

Slide 17 text

Consumer Contract Test Register expectation Request Account Service User Service Mock Contract Server TEST Response Contract File

Slide 18

Slide 18 text

User Service Get the contracts Assert the expectations from consumer Consumer Provider Mock Contract Server Account Service Provider Verification

Slide 19

Slide 19 text

Initialize Mock Server

Slide 20

Slide 20 text

Setup Expectations

Slide 21

Slide 21 text

Running Test

Slide 22

Slide 22 text

Demo Consumer Contract Test

Slide 23

Slide 23 text

Get the contracts Assert the expectations from consumer Provider Service Provider Verification

Slide 24

Slide 24 text

Provider Verification

Slide 25

Slide 25 text

Demo Provider Verification

Slide 26

Slide 26 text

Provider State

Slide 27

Slide 27 text

Setup Provider State

Slide 28

Slide 28 text

CDC In Action

Slide 29

Slide 29 text

Test As Part Of Source Code Separate Contract Test Code Consumer Test

Slide 30

Slide 30 text

Cloud Storage Contract Brokers Contract Sharing

Slide 31

Slide 31 text

Contract Verification Test External tools Provider Verification

Slide 32

Slide 32 text

Against Current Build Provider Verification In CI Against Stable Build

Slide 33

Slide 33 text

Tools

Slide 34

Slide 34 text

1. JVM 2. .Net 3. Ruby 4. Go 5. JavaScript 6. Python 7. Php 8. Swift You can implement you own https://pact.io Pact

Slide 35

Slide 35 text

Other Tool janus VCR PACTO

Slide 36

Slide 36 text

Convince Me https://docs.pact.io/faq/convinceme

Slide 37

Slide 37 text

Resources https://github.com/gopinath-langote/Pact-JVM-Implementation https://pact.io https://martinfowler.com/articles/microservice-testing/ https://www.martinfowler.com/articles/consumerDrivenContracts.html

Slide 38

Slide 38 text

Questions?

Slide 39

Slide 39 text

Thank You GopinathLangote