© AgiliX Agile Development Consulting What are the ODDS? Cesário Ramos.
Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices...
Transcript of Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices...
![Page 1: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/1.jpg)
Verifying microservices in chains without chain
testing?
Pascal Dufour
@pascal_dufour
![Page 2: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/2.jpg)
Pascal Dufour
AgiliX @ TestCon Europe 2019
Getting a Grip on Exploratory Testing
![Page 3: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/3.jpg)
Consumer Driven Contracts
What do you know.
1 minute
AgiliX @ TestCon Europe 2019
![Page 4: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/4.jpg)
A) Statement 1: Discuss 2 minute with your neighbor
B) Statement 1: Discus 3 minute with a pair of neighbors
C) Vote as a group
Debrief &Take aways
The plan for this “talk”
AgiliX @ TestCon Europe 2019
Basics
Repeat with statement 2
Repeat with statement 3
Repeat with statement 4
![Page 5: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/5.jpg)
AgiliX @ TestCon Europe 2019
![Page 6: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/6.jpg)
The Idea?
Producer
Consumer
x
Consumer
y
Consumer
z
A
B
C
A’
D
B’
E
Scenario’s
Contracts :
AgiliX @ TestCon Europe 2019
![Page 7: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/7.jpg)
Definitions
• Consumer Driven Contracts is a pattern that drives the development of the Producer from its Consumers point of view.
• ProducerService that exposes an API / Sends an message
• Consumer Service that consumes the the API of the producer /Send a request
• ContractAgreement between consumer and producer what the API / message will look like.
AgiliX @ TestCon Europe 2019
![Page 8: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/8.jpg)
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
![Page 9: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/9.jpg)
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
![Page 10: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/10.jpg)
Microservices
Is there for microservices a different test strategy?
AgiliX @ TestCon Europe 2019
e 2 e
Integration
Unit
![Page 11: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/11.jpg)
AgiliX @ TestCon Europe 2019
![Page 12: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/12.jpg)
CDC is only useful for testing the syntaxmax fieldlength, only
nummeric, optional/mandatory
AgiliX @ TestCon Europe 2019
![Page 13: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/13.jpg)
Relations between dependent fields should
be tested!When Tax amount is specified,
Tax % might be required
AgiliX @ TestCon Europe 2019
![Page 14: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/14.jpg)
A CDC-test should always break when a contract is changed!
AgiliX @ TestCon Europe 2019
![Page 15: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/15.jpg)
Every response status has a corresponding test!
A 404 (object not found)
AgiliX @ TestCon Europe 2019
![Page 16: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/16.jpg)
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
![Page 17: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/17.jpg)
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)• 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
![Page 18: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/18.jpg)
Thank you
All slides can be download at http://Agilix.nl/
AgiliX @ TestCon Europe 2019
![Page 19: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in](https://reader034.fdocuments.us/reader034/viewer/2022042307/5ed3e53754a8a36a2d475a33/html5/thumbnails/19.jpg)
Links
• Martin Fowler Consumer-Driven Contracts: A Service Evolution Pattern
• Marcin Grzejszczak consumer driven contract
• Spotify: Testing of Microservices
Special thanks to
AgiliX @ TestCon Europe 2019