CTO of Smart Gamma will talk In this speech about the problems that arise when testing applications built on a microservices architecture. We will conduct a brief overview of how to test the interaction between microservices. We will also talk in details about Consumer-Driven Contract Testing with an example of using the pact.io
8. Project V1 - monolith version
- Fuel control / GPS position system
- in-house fuel control hardware
- TomTom GPS position system as data gateway
- Monolith architecture for data processing via
WebFleet API
- UI customers area
9. Classic monolith testing
- Stable 3rd party API
- Classic testing requirements and approaches
- Data flows modeling before hardware is functional
10. Project’s evolution V2
- New 2nd sub-system for agriculture
- Extendable to 3rd sub-system for industry
- Own data processing system via GSM instead of
TomTom
- Universal hardware for all sub-
systems
- Hardware shop
11. End-2-end testing for data routing feature
- Mock entry point API with emulated flow
- Required etalon data fixtures preload or setup via QA API
- Setup test infrastructure with all services deployed
- Execute test
- Assert all expected behavior
20. What is a solution?
- Consumer-driven contracts
- Provider-driven contracts
21. https://docs.pact.io
“Do you set your house on fire
to test your smoke alarm?”
Pact PHP: https://github.com/pact-foundation/pact-php
22. Each consumer captures their expectations of the provider in a separate contract
Consumer-Driven Contracts
23. Pact framework
- Pact is contract testing framework
- Contract is a collection of
interactions.
- Each interaction consist of
expected request and minimal
expected response.
24. Pact framework
- Pact is contract testing framework
- Contract is a collection of
interactions.
- Each interaction consist of
expected request and minimal
expected response.
25. Pact framework
- Pact is contract testing framework
- Contract is a collection of
interactions.
- Each interaction consist of
expected request and minimal
expected response.
26. Pact framework
- Pact is contract testing framework
- Contract is a collection of
interactions.
- Each interaction consist of
expected request and minimal
expected response.
27. Pact framework
- Pact is contract testing framework
- Contract is a collection of
interactions.
- Each interaction consist of
expected request and minimal
expected response.
68. CI / Jenkins - Control backward compatibility by versions and tags
New consumer 1.0.2 changed schema expectation
New provider 1.0.2 changed provided schema
Provider 1.0.2 and Consumer 1.0.2 should be deployed simultaneously only!
71. - Replacement for functional tests of providers
- Replacement for OpenAPI/Swagger
- API for public consumers vs private consumers
What PACT is NOT: