Slide 1

Slide 1 text

How to test microservices and stay sane Tatiana Shepeleva @ Toptal

Slide 2

Slide 2 text

!2 toptal.com

Slide 3

Slide 3 text

What are microservices?

Slide 4

Slide 4 text

What are microservices?

Slide 5

Slide 5 text

What are microservices? • “Lightweight” API • Independently releasable • Have separate test suites

Slide 6

Slide 6 text

What are microservices? • “Lightweight” API • Independently releasable • Have separate test suites (but really?)

Slide 7

Slide 7 text

How to know if you can deploy?

Slide 8

Slide 8 text

Bored meme!

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Super end-to-end tests

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Cons • Expensive and complex infrastructure • Time consuming • Flaky

Slide 16

Slide 16 text

Contract tests

Slide 17

Slide 17 text

What is contract?

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

B has changed and you have end-to-end tests

Slide 22

Slide 22 text

B has changed and you have contract tests

Slide 23

Slide 23 text

Cons • Expensive and complex infrastructure ✅ • Time consuming ✅ • Flaky ✅

Slide 24

Slide 24 text

Also catch • Inconsistency in API • Typos

Slide 25

Slide 25 text

It’s not a silver bullet tho

Slide 26

Slide 26 text

docs.pact.io

Slide 27

Slide 27 text

Pact • Support different languages (Ruby, JS, Go, PHP, Python, JVM) • Framework-agnostic • Language-agnostic contract (JSON)

Slide 28

Slide 28 text

Storage for contracts • Your CI • Your codebase (projects) • Pact Broker

Slide 29

Slide 29 text

Pact Broker • Docker image is ready • Webhooks to trigger checks or notifications • can-i-deploy tool

Slide 30

Slide 30 text

Pact Broker PactBroker PactFlow

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

The end Tatiana Shepeleva tati.engineer