2. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS2019
Who I am ?
▶ Sébastien René
– Solution Architect
– Atos Expert Community
@sebastienrene
3. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS20193
Microservice architecture
4. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS20194
Microservice architecture
5. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS20195
A new application
6. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS20196
Have to deal with versions
v1 v5 v2
v2 v5 v1
7. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS20197
API documentation is static
Swagger UI
OpenAPI spec Service2
OpenAPI spec Service1
OpenAPI spec
8. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS20198
Application automated build, deployment, test
and release
Deployment
Pipeline
Code BinariesBuild & Package
Provisioning Environments
Functional Non functional (security,
performance,..)
Code
Orchestrate
B
Register
code
A Register
binaries
DBuild / Assemble
Verify complete
C
Verify
code
E
Deploy /
Release
F
Verify
functional
G Verify
non-functional
H
Define Design
TestRequest Business value
Release
Configure &
Develop
Development Production
Quality
control
Test & Acceptance (on demand) I
9. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS2019
▶ Advantages:
– Simulates production.
– Tests real communication between services.
▶ Disadvantages :
– To test one microservice, we have to deploy all microservices, databases, …
– The environment where the tests run is locked for a single suite of tests
(nobody else would be able to run the tests in the meantime).
– They take a long time to run.
– The feedback comes very late in the process.
– They are extremely hard to debug.
9
End to end platform tests
10. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS2019
▶ Advantages:
– They provide very fast feedback.
– They have no infrastructure requirements.
▶ Disadvantages:
– The implementor of the service creates stubs that might have nothing to do
with reality.
– You can go to production with passing tests and failing production.
10
Mock other services
11. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS201911
Contract testing
Consumer testing Provider verification
12. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS2019
▶ Test the interactions between
applications
▶ Make IT test easier to implement /
automate
▶ Acceptance test-driven developement
▶ Publish changes in contracts that are
immediately visible on both sides
12
Why I should use contracts ?
Enable
▶ Simulate all business features
▶ Create test scenario
▶ Performance and load testing
Not suitable for
13. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS2019
▶ Provider Contracts
– the producer of the API defines the
contracts and publishes it
– for producers that cannot directly
collaborate with their consumers
▶ Consumer-Driven Contracts
– the consumers describe how they
use the API
– for producer and consumer teams
working for the same organizations
13
Who creates the contract ?
14. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS201914
The tools
15. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS2019
▶ Spring Cloud Contracts
– Tests and stubs generator
• REST API
• Messaging
– Contracts and stub storage
• Nexus / Artifactory
• Git
• Pact
– Stub runner (WireMock)
15
The tools
16. | 17-10-2019 | 3ème édition Soirée du Test Logiciel Sophia #STLS201916
What is a Contract?