Seb Rose presented on microservice delivery and contract testing. He discussed managing dependencies between services, decoupling services using test doubles, and implementing contract tests with Pact to define and test the interactions between services. Pact uses a mock server to test contracts and a broker to publish pacts and coordinate verification between teams to enable independent deployment of services.
5. @sebrose h
tt
p:/
/smartbear.com
Design by contract
Design by contract
Contract
• an agreement between client
and supplier
Characteris
ti
cs
• expect some bene
fi
ts
• incur some obliga
ti
ons
14. @sebrose h
tt
p:/
/smartbear.com
JB Rainsberger, via GOOS mailing list, “Unit-test mock/stub assumptions rots”
15 March 2012
Systema
ti
c contract tes
ti
ng
• Collabora
ti
on tests make
assump
ti
ons about the contract
• Contract tests try to jus
ti
fy those
assump
ti
ons
JB Rainsberger, via GOOS mailing list, “Unit-test mock/stub assumptions rots”
15 March 2012
18. @sebrose h
tt
p:/
/smartbear.com
Pact provides a mechanism for crea
ti
ng a
contract between a service consumer and a
service provider, and then providing the tools
to validate that the consumer and provider
adhere to the contact independently of each
other.
https://dius.com.au/2014/05/19/simplifying-micro-service-testing-with-pacts/
Simplifying micro-service tes
ti
ng
19. @sebrose h
tt
p:/
/smartbear.com
•Consumer creates contracts using Pact DSL
•When consumer tests are run:
•Pact creates a mock HTTP server
•a Pact
fi
le is created
•Provider uses Pact
fi
le to verify compa
ti
bility
•Provider may o
ff
er “backdoor” interface
Pact - key points
24. @sebrose h
tt
p:/
/smartbear.com
• Pacts are published by Consumer
• Pacts are fetched by Provider
• Results are stored in the “Matrix”
• “Matrix” supports independent deployment
Pact broker - key points
25. @sebrose h
tt
p:/
/smartbear.com
Pact
fl
ow is the complete contract testing solution
allowing teams to orchestrate and scale their contract
testing initiative.
Visibility to focus on what ma
tt
ers
With Pact
fl
ow, developers can
fi
nd and
fi
x integration
errors earlier in the SDLC and teams can improve
communication & collaboration, reduce reliance on
E2E tests resulting in faster and safer deployments.