The days of delivering a monolithic desktop application once a year on physical media are long gone. Today we expect continuous (or at least frequent) delivery of upgrades and security patches with zero downtime. To support this, more and more companies are moving to a distributed, cloud-based architecture of collaborating micro-services. But managing and testing an evolving of a micro-service ecosystem is not without it’s challenges.
In this session we’ll examine what can go wrong when organisations jump headfirst into micro-service architectures without understanding the potential pitfalls. You’ll leave with an understanding of the techniques and tooling necessary to reap the benefits of increased flexibility and velocity without creating additional risk or deployment nightmares.
Streamlining Python Development: A Guide to a Modern Project Setup
Micro-service delivery - without the pitfalls
1. Micro-service delivery
- without the pitfalls
Seb Rose
Mastodon: @sebrose@mastodon.scot
Twitter: @sebrose
Blog: https://cucumber.io/blog/
E-mail: seb.rose@smartbear.com
Please help us by completing this 30 second
microservices and contract testing questionnaire.
https://bit.ly/PSTQB22-PACTFLOW
2. @sebrose h
tt
p:/
/smartbear.com
TL;DR
• All interac
ti
ons between so
ft
ware
components are governed by contracts
• Contract tes
ti
ng ensures that both
components have the same expecta
ti
ons
• Testers may not write these tests, but
they need to collaborate with developers
6. @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
19. @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
23. @sebrose h
tt
p:/
/smartbear.com
▪Closed and complete Provider contracts express a service's business
function capabilities in terms of the complete set of exportable elements
available to consumers, and as such are closed and complete with respect
to the functionality available to the system.
▪Singular and authoritative Provider contracts are singular and authoritative
in their expression of the business functionality available to the system.
▪Bounded stability and immutability A provider contract is stable and
immutable for a bounded period and/or locale. Provider contracts typically
use some form of versioning to differentiate differently bounded instances
of the contract.
https://martinfowler.com/articles/consumerDrivenContracts.html
Provider contracts
24. @sebrose h
tt
p:/
/smartbear.com
▪Open and incomplete Consumer contracts are open and incomplete with
respect to the business functionality available to the system. They
express a subset of the system's business function capabilities in terms of
the consumer's expectations of the provider contract.
▪Multiple and non-authoritative Consumer contracts are multiple in
proportion to the number of consumers of a service, and each is non-
authoritative with regard to the total set of contractual obligations placed
on the provider. Consumers may evolve at different rates.
▪Bounded stability and immutability Like provider contracts, consumer
contracts are valid for a particular period of time and/or location.
https://martinfowler.com/articles/consumerDrivenContracts.html
Consumer driven contracts (CDC)
31. @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
32. @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
37. @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
38. @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.
40. https://bddbooks.com
Please help us by completing this
30 second microservices and
contract testing questionnaire.
https://bit.ly/PSTQB22-PACTFLOW
Seb Rose
Mastodon: @sebrose@mastodon.scot
Twitter: @sebrose
Blog: https://cucumber.io/blog/
E-mail: seb.rose@smartbear.com