Slide 1

Slide 1 text

GopinathLangote Confidently Releasing Microservices With Consumer Driven Contract Testing Gopinath Langote

Slide 2

Slide 2 text

Confidently Releasing Microservices With Consumer Driven Contract Testing @GopinathLangote Confidence has a common meaning of a certainty about handling something, such as work, family, social events, or relationships. - Wikipedia

Slide 3

Slide 3 text

Confidently Releasing Microservices With Consumer Driven Contract Testing @GopinathLangote Ability of going to production

Slide 4

Slide 4 text

Confidently Releasing Microservices With Consumer Driven Contract Testing @GopinathLangote A particular way of designing software applications as suites of independently deployable services. - Martin Fowler

Slide 5

Slide 5 text

Confidently Releasing Microservices With Consumer Driven Contract testing Client / Consumer Server / Provider @GopinathLangote Offerings, plans, or strategies motivated by customer demand or expectations.

Slide 6

Slide 6 text

Confidently Releasing Microservices With Consumer Driven Contracts testing @GopinathLangote A contract is a legally binding agreement which recognises and governs the rights and duties of the parties to the agreement. - Wikipedia

Slide 7

Slide 7 text

Payments Team Growth Team Problem Statement @GopinathLangote

Slide 8

Slide 8 text

Refactoring @GopinathLangote

Slide 9

Slide 9 text

Unit Tests Mocked Integration Tests Functional Tests Manual Tests Test Pyramid @GopinathLangote

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

Mocked Integratio n Test @GopinathLangote

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

Real User Service Time Consuming Longer Feedback Loop Trustworthy Functional Test @GopinathLangote

Slide 14

Slide 14 text

Manual Test @GopinathLangote

Slide 15

Slide 15 text

Unit Tests Contract Test Functional Manual Tests Test Pyramid @GopinathLangote

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

1. Setup Expectations @GopinathLangote

Slide 20

Slide 20 text

Contract @GopinathLangote

Slide 21

Slide 21 text

2. Running Test @GopinathLangote

Slide 22

Slide 22 text

3. Provider Verification @GopinathLangote

Slide 23

Slide 23 text

Demo Consumer Contract Test @GopinathLangote

Slide 24

Slide 24 text

CDC In Action @GopinathLangote

Slide 25

Slide 25 text

Cloud Storage Contract Brokers Contract Sharing @GopinathLangote

Slide 26

Slide 26 text

Against Current Build Provider Verification In CI Against Stable Build @GopinathLangote

Slide 27

Slide 27 text

Microservices Architecture When services are handled by multiple teams/companies When to do CDC? @GopinathLangote

Slide 28

Slide 28 text

Manually talk to concerned team/partner What if contract fails - Communication Automate communication 1. Automatic email 2. Automatic Jira tickets 3. Send alerts to slack @GopinathLangote

Slide 29

Slide 29 text

Tools @GopinathLangote

Slide 30

Slide 30 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 @GopinathLangote

Slide 31

Slide 31 text

Other Tool janus VCR PACTO @GopinathLangote

Slide 32

Slide 32 text

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

Slide 33

Slide 33 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 @GopinathLangote

Slide 34

Slide 34 text

Thank You GopinathLangote