Verifying Microservices in Chains without Chain Testing?
In large companies we use large (production like) acceptance test environments to validate the system. These environments are not only often fragile but also expensive to maintain. Due to the popularity of micro services we deploy more often, which decreases the availability of these environments. What if we skip the acceptance test environment for releasing to production? Can we still guarantee the quality of our end to end chain? How do we know our new version is working, without verification in an end to end acceptance environment? In this interactive session you will learn how you can mitigate the risk not having an end to end acceptance environment by use of Consumer Driven Contracts (contract testing).
3. A) Statement 1: Discuss 2 minute with your neighbor
B) Statement 1: Discuss 3 minute with a pair of neighbors
C) Vote as a group
Debrief &Take aways
The plan for this “talk”
AgiliX @ TestCon Europe 2019
The idea
Repeat with statement 2
Repeat with statement 3
How did we get contract testing to work
6. AgiliX @ TestCon Europe 2019
Chain testing reality
• The real thing
• Visual tests
• Business test
• Realistic simulations
• Connected to all external
systems
• ”All” user test are possible
Positive
• Test data (hell)
• Never in sync (configuration)
• Long run time
• Difficult to debug
• Late feedback
• Too many dependencies
• Operation costs
• False sense of security
Negative
8. Definitions
• Consumer Driven Contracts is a pattern that drives the
development of the Producer from its Consumers point of view.
• Producer
Service that exposes an API / Sends an message
• Consumer
Service that consumes the the API of the producer /Send a request
• Contract
Agreement between consumer and producer what the API / message
will look like.
AgiliX @ TestCon Europe 2019
9. Which problems solves CDC
• Late feedback from a changing API.
• Producer design not fitting the expectation by consumers
• Unclear expectation of the behavior of the API
AgiliX @ TestCon Europe 2019
10. Microservices
Is there for microservices a different test strategy?
AgiliX @ TestCon Europe 2019
e 2 e
Integration
Unit
11. A) Statement 1: Discuss 2 minute with your neighbor
B) Statement 1: Discuss 3 minute with a pair of neighbors
C) Vote as a group
Debrief &Take aways
The plan for this “talk”
AgiliX @ TestCon Europe 2019
The idea
Repeat with statement 2
Repeat with statement 3
How did we get contract testing to work
13. CDC is only useful for
testing the syntax
max fieldlength, only
nummeric, etc.
AgiliX @ TestCon Europe 2019
Huh? / Really? / So?
14. Relations between
dependent fields should
be tested!
When Tax amount is specified,
Tax % might be required
AgiliX @ TestCon Europe 2019
Huh? / Really? / So?
15. A CDC-test should
always break when a
contract is changed!
AgiliX @ TestCon Europe 2019
Huh? / Really? / So?
16. Debrief
• Consumer Driven Contracts is a pattern that drives the
development of the Producer from its Consumers point of view.
• Force communication
• Formal
• Documentation
• Fast feedback during development
AgiliX @ TestCon Europe 2019
17. How did we get it to work
• No availability of the acceptance test environment
(production like) anymore
• A few determined enthusiastic developers
• Setup pipelines / examples
• Frequent Knowledge sessions
• Mentoring others who where new.
• Each teams monitor his own tests.
• Review cross team
AgiliX @ TestCon Europe 2019
18. Take aways
• Consumer Driven Contracts is a pattern that drives the
development of the Producer from its Consumers point of view.
• Force communication
• Fast feedback to the developer.
• Producer design seen as black box (design should be tested by
producer it self)
• Determined enthusiastic developers
• Data format like an IBAN number should be tested.
• Contract should be extendable (adding additional fields by the
producer should be possible.)
• Stubs needed for the contract are useful elsewhere
• The principle of CDC can be used outside micro services.
AgiliX @ TestCon Europe 2019
19. Join Slido.com with #testcon2019
Thank you
All slides can be download at
http://Agilix.nl/
AgiliX @ TestCon Europe 2019
20. Links
• Martin Fowler Consumer-Driven Contracts: A Service Evolution
Pattern
• Marcin Grzejszczak consumer driven contract
• Spotify: Testing of Microservices
Special thanks to
Cirilo wortel
Daan Koolman
AgiliX @ TestCon Europe 2019