SlideShare a Scribd company logo
Consumer-Driven Contract Testing
Implementing a scalable testing strategy for Microservices
Paulo Clavijo Esteban
@pclavijo - January 2018
About me
Principal Software Engineer at Dell-EMC
Organizer Cork Software Crafters meetup
Paulo Clavijo @pclavijo - January 2018
Cork Software CraftersPaulo Clavijo Esteban @pclavijo
paucls.wordpress.com
github.com/paucls
Context
● < 2014 - Monolithic systems
○ Unit tests, Integrations Tests and slow Webdriver E2E tests.
● 2014 - Transition to Microservices architecture and web apps
○ Services tested with Unit tests, Component tests.
○ Web apps with Unit tests and E2E tests using a stub backend.
○ System Integration tests limited to high-value User Journeys.
● 2016 - CD Pipelines
○ Teams doing Continuous Delivery. Feature Toggles.
○ Continuous Deployment only to Staging.
● 2017 - Implemented Consumer-Driven Contract Tests
○ Solved the REST APIs integration issues. Full CD to Production.
Paulo Clavijo @pclavijo - January 2018
Context
A previous attempt of using Contract Tests didn’t work out
● Contract testing purpose and value was not understood properly.
● Introduced partially without bringing real value.
○ Only consumer contracts for Java services without corresponding providers test.
○ Not used on Web apps.
○ No integration with CI/CD pipeline, pull requests.
○ Overhead of writing them didn’t pay off.
● Tests scope was too broad.
● Shared client libraries. No Front-end first / CDC flow.
Paulo Clavijo @pclavijo - January 2018
The Challenge
Multiple feature teams, applications, microservices. Independent
deployments, ...
… REST APIs integration issues.
How to test collaboration between system components?
● Isolated Component Tests, Test Doubles and the Test
Symmetry problem
● Integration Tests?
● System End-to-end tests?
Web-app
to Service
Service to
Service
Paulo Clavijo @pclavijo - January 2018
Contract Tests
Traditionally understood as a separate set of tests that checks that all the calls against
your test doubles return the same results as a call to the remote service would.
Consumer
Remote
Service
Test Double
Unit tests Contract tests
Paulo Clavijo @pclavijo - January 2018
Consumer-Driven Contract Tests
Unit tests in both sides where consumers detail clearly what are the interactions and
behaviours expected from the provider API.
Consumer Provider
Consumer
Contracts
Test Double
Verify on providerRecord consumer
expectations
Unit tests Unit tests
Paulo Clavijo @pclavijo - January 2018
Consumer-Driven Contract Tests
Consumer Driven Contracts (CDC) is a pattern that drives the development of the Provider
from its Consumer's point of view. It is TDD for services.
It is possible to make changes on a provider knowing that consumers won't be impacted!
Consumer A
Consumer B
Consumer C
Provider
Consumer-Driven
Contract
{ Id: 100,
name: “A task” }
{ Id: 100,
name: “A task”
expedite: true }
{ Id: 100,
duration: 20 }
{ Id: 100,
name: “A task”,
expedite: true,
duration: 20 }
Consumer Contract A
Consumer Contract B
Consumer Contract C
Paulo Clavijo @pclavijo - January 2018
Consumer-Driven Contract Tests
They do not test the behaviour of the service in depth but that the inputs and outputs of
service calls contain required attributes.
https://martinfowler.com/articles/microservice-testing
Paulo Clavijo @pclavijo - January 2018
Consumer-Driven Contracts
Great for developing and testing intra-organisation microservices.
● You (or your team/organisation/partner organisation) control the development of both the
consumer and the provider.
● The requirements of the consumer(s) are going to be used to drive the features of the
provider.
● There is a small enough number of consumers for a given provider that the provider team can
manage an individual relationship with each consumer team.
https://docs.pact.io/documentation/what_is_pact_good_for.html
Paulo Clavijo @pclavijo - January 2018
Pact
● Some of the tools that support Consumer-Driven Contract Testing are Pact and
Spring Cloud Contract.
● We chose Pact because:
○ Generation of contracts from the code
○ Provider verification (pact-jvm-provider-junit)
○ Supports multiple languages JVM, Node, JS web apps, …
○ Pact Specification
○ Pact Broker
Paulo Clavijo @pclavijo - January 2018
Pact Broker
● Helps managing, versioning and distributing
contracts.
● Great tool to visualize contracts and system
relationships (dependency graph).
● Contracts as a form of “Live Documentation” for
APIs and interactions between components.
Paulo Clavijo @pclavijo - January 2018
Implementing CDC
CDC on the Consumer side
Consumer
Contracts
Provider
Contract
Tests
1) Define expected interactions
2) Tests the API Client
code on the consumer
Provider
Contract
Tests
Consumer
Contract
Tests
4) Generates contracts
Consumer
API Client
Pact Mock
Service
3) Verify interactions
Paulo Clavijo @pclavijo - January 2018
CDC on the Consumer side
1) Define expected interactions
2) Tests the API Client code
3) Verify interactions
Paulo Clavijo @pclavijo - January 2018
CDC on the Consumer side
4) Pact Mock Service generates contract
files for successful tests
These contracts, in a CDC flow, can
now be shared and used to drive the
development of the provider.
Paulo Clavijo @pclavijo - January 2018
Contract Testing on the Provider side
Consumer
Contracts
Provider
A
P
I
Provider
Contract
Tests
1) Pact auto-generates provider tests
3) Tests the provider
Provider
Contract
Tests
Provider
Contract
Tests
2) Set-up provider state
Paulo Clavijo @pclavijo - January 2018
Contract Testing on the Provider side
Auto-generated Pact provider contract tests
Paulo Clavijo @pclavijo - January 2018
Paulo Clavijo @pclavijo - January 2018
Contract Testing on the Provider side
Pact uses the state description on the
contract to determine which set-up logic
needs to be executed before running a
generated test.
Contract Testing on the Provider side
Let’s implement a new end-point ...
Contract Testing on the Provider side
Let’s implement a new end-point ...
Contract Testing on the Provider side
Tests fail when changes in Provider impacts a Consumer
Flexible Matching
Pact provides flexible matching by regular
expressions or type.
Paulo Clavijo @pclavijo - January 2018
Defining Interactions
When we define the expected interactions between a consumer and a provider, the ‘state’ and
‘uponReceiving’ descriptions used should be written in a consistent style.
Later on, on the provider side, Pact uses the uponReceiving description to name the auto-generated
test, and the state description is used to find a corresponding test state.
// Expected Interaction
provider.addInteraction({
state: 'a task with id task-id exists',
uponReceiving: 'a request to delete task task-id',
withRequest: {method: 'DELETE', path: '/tasks/task-id'},
willRespondWith: {status: 204}
});
Paulo Clavijo @pclavijo - January 2018
Defining Interactions
Examples
Successful interaction where data is returned
state: ‘tasks for project with id project-id exist’,
uponReceiving: ‘a request to get tasks for that project’
Successful interaction where no data is returned
state: ‘tasks for project with id project-id do not exist’,
uponReceiving: ‘a request to get tasks for that project’
404 error interaction
state: ‘project project-id does not exist’,
uponReceiving: ‘a request to get tasks for that project’
Domain validation error interaction
state: ‘a task task-id exists and domain rules exist that prevent its
modification’,
uponReceiving: ‘a request to update that task’
Successful interaction where data is created
state: ‘a project with name project-1 does not exist’,
uponReceiving: ‘a request to create a project with name project-1’
Paulo Clavijo @pclavijo - January 2018
Live Documentation
Contracts are not only used by the tests, we also intent them to be user-friendly. Developers
can consult contracts in the Pact Broker who shows them in a nice documentation style.
Paulo Clavijo @pclavijo - January 2018
CDC in our pipeline
Paulo Clavijo @pclavijo - January 2018
CDC vs Contract Tests
TDD is more than having Unit Tests …
… CDC is more than having Contract Tests
Think in it as Outside-In TDD for a whole system!
Is what we do, a technique and attitude, discipline on the
design and development flow.
Paulo Clavijo @pclavijo - January 2018
What is next?
● Pact v3
○ Contract testing for messages (for services that communicate via event streams and message
queues)
● Pact v4
○ Matching times and dates in a cross-platform manner
○ Additional Matchers
● … Beyond REST APIs. GraphQL?
○ Servers publish a statically typed system specific to their application, and GraphQL provides a
unified language to query data within the constraints of that type system.
Paulo Clavijo @pclavijo - January 2018
Further reading
● Implementing Consumer-Driven Contract tests in Angular, Paulo Clavijo
https://paucls.wordpress.com/2017/08/04/pact-consumer-driven-contract-imple
mentation-in-angular
● Configure Pact JS Consumer Contract tests in Angular, Paulo Clavijo
https://paucls.wordpress.com/2017/08/04/configure-pact-js-consumer-contract-
tests-in-angular
● Sample project on Provider Side
https://github.com/paucls/task_list_api-kotlin-pact
Paulo Clavijo @pclavijo - January 2018
References
● ContractTest, Martin Fowler. https://martinfowler.com/bliki/ContractTest.html
● Pact documentation https://docs.pact.io/documentation/implementation_guides.html
● Testing Strategies in a Microservice Architecture, Toby Clemson
https://martinfowler.com/articles/microservice-testing/
● Integrated Tests Are A Scam, J.B. Rainsberger
http://blog.thecodewhisperer.com/permalink/integrated-tests-are-a-scam
● Consumer-Driven Contracts: A Service Evolution Pattern, Ian Robinson
https://www.martinfowler.com/articles/consumerDrivenContracts.html
● Microservices, Flexible Software Architecture. Eberhard Wolff.
● Contract testing with GraphQL, Andreas Marek
https://www.andimarek.com/post/contract-testing-graphql
● https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-junit
Paulo Clavijo @pclavijo - January 2018
Consumer-Driven Contract Testing
Implementing a scalable testing strategy for Microservices
Paulo Clavijo Esteban
@pclavijo - January 2018

More Related Content

What's hot

DevOps & SRE at Google Scale
DevOps & SRE at Google ScaleDevOps & SRE at Google Scale
DevOps & SRE at Google Scale
Kaushik Bhattacharya
 
Istio : Service Mesh
Istio : Service MeshIstio : Service Mesh
Istio : Service Mesh
Knoldus Inc.
 
Microservices Design Patterns Explained | Edureka
Microservices Design Patterns Explained | EdurekaMicroservices Design Patterns Explained | Edureka
Microservices Design Patterns Explained | Edureka
Edureka!
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
MahmoudZidan41
 
Architecture: Microservices
Architecture: MicroservicesArchitecture: Microservices
Architecture: Microservices
Amazon Web Services
 
GitOps Testing in Kubernetes with Flux and Testkube.pdf
GitOps Testing in Kubernetes with Flux and Testkube.pdfGitOps Testing in Kubernetes with Flux and Testkube.pdf
GitOps Testing in Kubernetes with Flux and Testkube.pdf
Weaveworks
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
Julien Pivotto
 
Contract based testing
Contract based testingContract based testing
Contract based testing
Alisa Petivotova
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
Hawkman Academy
 
gRPC Overview
gRPC OverviewgRPC Overview
gRPC Overview
Varun Talwar
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICD
Knoldus Inc.
 
Modern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOpsModern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOps
GlobalLogic Ukraine
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
rajdeep
 
DevOps on AWS - Building Systems to Deliver Faster
DevOps on AWS - Building Systems to Deliver FasterDevOps on AWS - Building Systems to Deliver Faster
DevOps on AWS - Building Systems to Deliver Faster
Amazon Web Services
 
Terraform and Weave GitOps: Build a Fully Automated Application Stack
Terraform and Weave GitOps: Build a Fully Automated Application StackTerraform and Weave GitOps: Build a Fully Automated Application Stack
Terraform and Weave GitOps: Build a Fully Automated Application Stack
Weaveworks
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architecture
Abdelghani Azri
 
Introduction to Istio Service Mesh
Introduction to Istio Service MeshIntroduction to Istio Service Mesh
Introduction to Istio Service Mesh
Georgios Andrianakis
 
ArgoCD Meetup PPT final.pdf
ArgoCD Meetup PPT final.pdfArgoCD Meetup PPT final.pdf
ArgoCD Meetup PPT final.pdf
amanmakwana3
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
Amazon Web Services
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
Bytemark
 

What's hot (20)

DevOps & SRE at Google Scale
DevOps & SRE at Google ScaleDevOps & SRE at Google Scale
DevOps & SRE at Google Scale
 
Istio : Service Mesh
Istio : Service MeshIstio : Service Mesh
Istio : Service Mesh
 
Microservices Design Patterns Explained | Edureka
Microservices Design Patterns Explained | EdurekaMicroservices Design Patterns Explained | Edureka
Microservices Design Patterns Explained | Edureka
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Architecture: Microservices
Architecture: MicroservicesArchitecture: Microservices
Architecture: Microservices
 
GitOps Testing in Kubernetes with Flux and Testkube.pdf
GitOps Testing in Kubernetes with Flux and Testkube.pdfGitOps Testing in Kubernetes with Flux and Testkube.pdf
GitOps Testing in Kubernetes with Flux and Testkube.pdf
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
Contract based testing
Contract based testingContract based testing
Contract based testing
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
gRPC Overview
gRPC OverviewgRPC Overview
gRPC Overview
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICD
 
Modern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOpsModern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOps
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
DevOps on AWS - Building Systems to Deliver Faster
DevOps on AWS - Building Systems to Deliver FasterDevOps on AWS - Building Systems to Deliver Faster
DevOps on AWS - Building Systems to Deliver Faster
 
Terraform and Weave GitOps: Build a Fully Automated Application Stack
Terraform and Weave GitOps: Build a Fully Automated Application StackTerraform and Weave GitOps: Build a Fully Automated Application Stack
Terraform and Weave GitOps: Build a Fully Automated Application Stack
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architecture
 
Introduction to Istio Service Mesh
Introduction to Istio Service MeshIntroduction to Istio Service Mesh
Introduction to Istio Service Mesh
 
ArgoCD Meetup PPT final.pdf
ArgoCD Meetup PPT final.pdfArgoCD Meetup PPT final.pdf
ArgoCD Meetup PPT final.pdf
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 

Similar to Consumer-Driven Contract Testing

TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for Microservices
VMware Tanzu
 
Consumer Driven Contracts
Consumer Driven ContractsConsumer Driven Contracts
Consumer Driven Contracts
Visuality
 
Consumer Driven Contracts for microservices
Consumer Driven Contracts for microservicesConsumer Driven Contracts for microservices
Consumer Driven Contracts for microservices
Reshmi Krishna
 
Consumer driven contracts in java world
Consumer driven contracts in java worldConsumer driven contracts in java world
Consumer driven contracts in java world
Yura Nosenko
 
How to Ensure your Definition of Done is Well Done not Half-Baked
How to Ensure your Definition of Done is Well Done not Half-BakedHow to Ensure your Definition of Done is Well Done not Half-Baked
How to Ensure your Definition of Done is Well Done not Half-Baked
Susan Schanta
 
Coherent REST API design
Coherent REST API designCoherent REST API design
Coherent REST API design
Frederik Mogensen
 
R.D.Fernandez et al - Software rates vs price of function points
R.D.Fernandez et al  - Software rates vs price of function pointsR.D.Fernandez et al  - Software rates vs price of function points
R.D.Fernandez et al - Software rates vs price of function points
International Software Benchmarking Standards Group (ISBSG)
 
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
Webinar-From user stories to automated acceptance tests with BDD-Eduardo RiolWebinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
atSistemas
 
Testing microservices, contract testing
Testing microservices, contract testingTesting microservices, contract testing
Testing microservices, contract testing
Daria Golub
 
Agile Contracts
Agile ContractsAgile Contracts
Agile Contracts
Johannes Brodwall
 
Drive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
Drive Business Excellence with Outcomes-Based Contracting: The OBC ToolkitDrive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
Drive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
CAST
 
Expo qa from user stories to automated acceptance tests with bdd
Expo qa   from user stories to automated acceptance tests with bddExpo qa   from user stories to automated acceptance tests with bdd
Expo qa from user stories to automated acceptance tests with bdd
Eduardo Riol
 
Micro-service delivery - without the pitfalls
Micro-service delivery - without the pitfallsMicro-service delivery - without the pitfalls
Micro-service delivery - without the pitfalls
Seb Rose
 
Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)
Rob Crowley
 
Microservices: Consumer Driven Contracts in Practice
Microservices: Consumer Driven Contracts in PracticeMicroservices: Consumer Driven Contracts in Practice
Microservices: Consumer Driven Contracts in Practice
Qaiser Mazhar
 
Dynamics 365 Bid Management for Construction Projects
Dynamics 365 Bid Management for Construction ProjectsDynamics 365 Bid Management for Construction Projects
Dynamics 365 Bid Management for Construction Projects
Dynamic Netsoft
 
Guidewire Connections 2023 DE-4 Using AI to Accelerate Application Integration
Guidewire Connections 2023 DE-4 Using AI to Accelerate Application IntegrationGuidewire Connections 2023 DE-4 Using AI to Accelerate Application Integration
Guidewire Connections 2023 DE-4 Using AI to Accelerate Application Integration
BrianPetrini
 
software sourcing presentation
software sourcing presentationsoftware sourcing presentation
software sourcing presentation
Manoj Abraham
 
Take The Highway To A Successful It Project
Take The Highway To A Successful It ProjectTake The Highway To A Successful It Project
Take The Highway To A Successful It Projectsantosh singh
 
Asbo Vendor Performance Eval Chicago 092509
Asbo Vendor Performance Eval   Chicago   092509Asbo Vendor Performance Eval   Chicago   092509
Asbo Vendor Performance Eval Chicago 092509Richard Gay, CPPO, RSBO
 

Similar to Consumer-Driven Contract Testing (20)

TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for Microservices
 
Consumer Driven Contracts
Consumer Driven ContractsConsumer Driven Contracts
Consumer Driven Contracts
 
Consumer Driven Contracts for microservices
Consumer Driven Contracts for microservicesConsumer Driven Contracts for microservices
Consumer Driven Contracts for microservices
 
Consumer driven contracts in java world
Consumer driven contracts in java worldConsumer driven contracts in java world
Consumer driven contracts in java world
 
How to Ensure your Definition of Done is Well Done not Half-Baked
How to Ensure your Definition of Done is Well Done not Half-BakedHow to Ensure your Definition of Done is Well Done not Half-Baked
How to Ensure your Definition of Done is Well Done not Half-Baked
 
Coherent REST API design
Coherent REST API designCoherent REST API design
Coherent REST API design
 
R.D.Fernandez et al - Software rates vs price of function points
R.D.Fernandez et al  - Software rates vs price of function pointsR.D.Fernandez et al  - Software rates vs price of function points
R.D.Fernandez et al - Software rates vs price of function points
 
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
Webinar-From user stories to automated acceptance tests with BDD-Eduardo RiolWebinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
 
Testing microservices, contract testing
Testing microservices, contract testingTesting microservices, contract testing
Testing microservices, contract testing
 
Agile Contracts
Agile ContractsAgile Contracts
Agile Contracts
 
Drive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
Drive Business Excellence with Outcomes-Based Contracting: The OBC ToolkitDrive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
Drive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
 
Expo qa from user stories to automated acceptance tests with bdd
Expo qa   from user stories to automated acceptance tests with bddExpo qa   from user stories to automated acceptance tests with bdd
Expo qa from user stories to automated acceptance tests with bdd
 
Micro-service delivery - without the pitfalls
Micro-service delivery - without the pitfallsMicro-service delivery - without the pitfalls
Micro-service delivery - without the pitfalls
 
Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)Consumer Driven Contracts (DDD Perth 2016)
Consumer Driven Contracts (DDD Perth 2016)
 
Microservices: Consumer Driven Contracts in Practice
Microservices: Consumer Driven Contracts in PracticeMicroservices: Consumer Driven Contracts in Practice
Microservices: Consumer Driven Contracts in Practice
 
Dynamics 365 Bid Management for Construction Projects
Dynamics 365 Bid Management for Construction ProjectsDynamics 365 Bid Management for Construction Projects
Dynamics 365 Bid Management for Construction Projects
 
Guidewire Connections 2023 DE-4 Using AI to Accelerate Application Integration
Guidewire Connections 2023 DE-4 Using AI to Accelerate Application IntegrationGuidewire Connections 2023 DE-4 Using AI to Accelerate Application Integration
Guidewire Connections 2023 DE-4 Using AI to Accelerate Application Integration
 
software sourcing presentation
software sourcing presentationsoftware sourcing presentation
software sourcing presentation
 
Take The Highway To A Successful It Project
Take The Highway To A Successful It ProjectTake The Highway To A Successful It Project
Take The Highway To A Successful It Project
 
Asbo Vendor Performance Eval Chicago 092509
Asbo Vendor Performance Eval   Chicago   092509Asbo Vendor Performance Eval   Chicago   092509
Asbo Vendor Performance Eval Chicago 092509
 

More from Paulo Clavijo

Consumer-Driven Contract Testing - Workshop - January 2021
Consumer-Driven Contract Testing - Workshop - January 2021Consumer-Driven Contract Testing - Workshop - January 2021
Consumer-Driven Contract Testing - Workshop - January 2021
Paulo Clavijo
 
User story slicing exercise
User story slicing exerciseUser story slicing exercise
User story slicing exercise
Paulo Clavijo
 
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
Paulo Clavijo
 
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Paulo Clavijo
 
Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019
Paulo Clavijo
 
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
Paulo Clavijo
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
Paulo Clavijo
 
TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018
Paulo Clavijo
 
Outside-in TDD with Test Doubles
Outside-in TDD with Test DoublesOutside-in TDD with Test Doubles
Outside-in TDD with Test Doubles
Paulo Clavijo
 
Angular and Redux
Angular and ReduxAngular and Redux
Angular and Redux
Paulo Clavijo
 
DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018
DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018
DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018
Paulo Clavijo
 
ATDD - Desarrollo Dirigido por Test de Aceptación
ATDD - Desarrollo Dirigido por Test de AceptaciónATDD - Desarrollo Dirigido por Test de Aceptación
ATDD - Desarrollo Dirigido por Test de Aceptación
Paulo Clavijo
 
Tests Unitarios con JUnit 4
Tests Unitarios con JUnit 4Tests Unitarios con JUnit 4
Tests Unitarios con JUnit 4
Paulo Clavijo
 
Gestión de Cambios de BBDD con LiquiBase
Gestión de Cambios de BBDD con LiquiBaseGestión de Cambios de BBDD con LiquiBase
Gestión de Cambios de BBDD con LiquiBase
Paulo Clavijo
 
Introducción a Spring Roo
Introducción a Spring RooIntroducción a Spring Roo
Introducción a Spring Roo
Paulo Clavijo
 

More from Paulo Clavijo (15)

Consumer-Driven Contract Testing - Workshop - January 2021
Consumer-Driven Contract Testing - Workshop - January 2021Consumer-Driven Contract Testing - Workshop - January 2021
Consumer-Driven Contract Testing - Workshop - January 2021
 
User story slicing exercise
User story slicing exerciseUser story slicing exercise
User story slicing exercise
 
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
 
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
 
Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019
 
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018
 
Outside-in TDD with Test Doubles
Outside-in TDD with Test DoublesOutside-in TDD with Test Doubles
Outside-in TDD with Test Doubles
 
Angular and Redux
Angular and ReduxAngular and Redux
Angular and Redux
 
DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018
DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018
DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018
 
ATDD - Desarrollo Dirigido por Test de Aceptación
ATDD - Desarrollo Dirigido por Test de AceptaciónATDD - Desarrollo Dirigido por Test de Aceptación
ATDD - Desarrollo Dirigido por Test de Aceptación
 
Tests Unitarios con JUnit 4
Tests Unitarios con JUnit 4Tests Unitarios con JUnit 4
Tests Unitarios con JUnit 4
 
Gestión de Cambios de BBDD con LiquiBase
Gestión de Cambios de BBDD con LiquiBaseGestión de Cambios de BBDD con LiquiBase
Gestión de Cambios de BBDD con LiquiBase
 
Introducción a Spring Roo
Introducción a Spring RooIntroducción a Spring Roo
Introducción a Spring Roo
 

Recently uploaded

Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 

Recently uploaded (20)

Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 

Consumer-Driven Contract Testing

  • 1. Consumer-Driven Contract Testing Implementing a scalable testing strategy for Microservices Paulo Clavijo Esteban @pclavijo - January 2018
  • 2. About me Principal Software Engineer at Dell-EMC Organizer Cork Software Crafters meetup Paulo Clavijo @pclavijo - January 2018 Cork Software CraftersPaulo Clavijo Esteban @pclavijo paucls.wordpress.com github.com/paucls
  • 3. Context ● < 2014 - Monolithic systems ○ Unit tests, Integrations Tests and slow Webdriver E2E tests. ● 2014 - Transition to Microservices architecture and web apps ○ Services tested with Unit tests, Component tests. ○ Web apps with Unit tests and E2E tests using a stub backend. ○ System Integration tests limited to high-value User Journeys. ● 2016 - CD Pipelines ○ Teams doing Continuous Delivery. Feature Toggles. ○ Continuous Deployment only to Staging. ● 2017 - Implemented Consumer-Driven Contract Tests ○ Solved the REST APIs integration issues. Full CD to Production. Paulo Clavijo @pclavijo - January 2018
  • 4. Context A previous attempt of using Contract Tests didn’t work out ● Contract testing purpose and value was not understood properly. ● Introduced partially without bringing real value. ○ Only consumer contracts for Java services without corresponding providers test. ○ Not used on Web apps. ○ No integration with CI/CD pipeline, pull requests. ○ Overhead of writing them didn’t pay off. ● Tests scope was too broad. ● Shared client libraries. No Front-end first / CDC flow. Paulo Clavijo @pclavijo - January 2018
  • 5. The Challenge Multiple feature teams, applications, microservices. Independent deployments, ... … REST APIs integration issues. How to test collaboration between system components? ● Isolated Component Tests, Test Doubles and the Test Symmetry problem ● Integration Tests? ● System End-to-end tests? Web-app to Service Service to Service Paulo Clavijo @pclavijo - January 2018
  • 6. Contract Tests Traditionally understood as a separate set of tests that checks that all the calls against your test doubles return the same results as a call to the remote service would. Consumer Remote Service Test Double Unit tests Contract tests Paulo Clavijo @pclavijo - January 2018
  • 7. Consumer-Driven Contract Tests Unit tests in both sides where consumers detail clearly what are the interactions and behaviours expected from the provider API. Consumer Provider Consumer Contracts Test Double Verify on providerRecord consumer expectations Unit tests Unit tests Paulo Clavijo @pclavijo - January 2018
  • 8. Consumer-Driven Contract Tests Consumer Driven Contracts (CDC) is a pattern that drives the development of the Provider from its Consumer's point of view. It is TDD for services. It is possible to make changes on a provider knowing that consumers won't be impacted! Consumer A Consumer B Consumer C Provider Consumer-Driven Contract { Id: 100, name: “A task” } { Id: 100, name: “A task” expedite: true } { Id: 100, duration: 20 } { Id: 100, name: “A task”, expedite: true, duration: 20 } Consumer Contract A Consumer Contract B Consumer Contract C Paulo Clavijo @pclavijo - January 2018
  • 9. Consumer-Driven Contract Tests They do not test the behaviour of the service in depth but that the inputs and outputs of service calls contain required attributes. https://martinfowler.com/articles/microservice-testing Paulo Clavijo @pclavijo - January 2018
  • 10. Consumer-Driven Contracts Great for developing and testing intra-organisation microservices. ● You (or your team/organisation/partner organisation) control the development of both the consumer and the provider. ● The requirements of the consumer(s) are going to be used to drive the features of the provider. ● There is a small enough number of consumers for a given provider that the provider team can manage an individual relationship with each consumer team. https://docs.pact.io/documentation/what_is_pact_good_for.html Paulo Clavijo @pclavijo - January 2018
  • 11. Pact ● Some of the tools that support Consumer-Driven Contract Testing are Pact and Spring Cloud Contract. ● We chose Pact because: ○ Generation of contracts from the code ○ Provider verification (pact-jvm-provider-junit) ○ Supports multiple languages JVM, Node, JS web apps, … ○ Pact Specification ○ Pact Broker Paulo Clavijo @pclavijo - January 2018
  • 12. Pact Broker ● Helps managing, versioning and distributing contracts. ● Great tool to visualize contracts and system relationships (dependency graph). ● Contracts as a form of “Live Documentation” for APIs and interactions between components. Paulo Clavijo @pclavijo - January 2018
  • 14. CDC on the Consumer side Consumer Contracts Provider Contract Tests 1) Define expected interactions 2) Tests the API Client code on the consumer Provider Contract Tests Consumer Contract Tests 4) Generates contracts Consumer API Client Pact Mock Service 3) Verify interactions Paulo Clavijo @pclavijo - January 2018
  • 15. CDC on the Consumer side 1) Define expected interactions 2) Tests the API Client code 3) Verify interactions Paulo Clavijo @pclavijo - January 2018
  • 16. CDC on the Consumer side 4) Pact Mock Service generates contract files for successful tests These contracts, in a CDC flow, can now be shared and used to drive the development of the provider. Paulo Clavijo @pclavijo - January 2018
  • 17. Contract Testing on the Provider side Consumer Contracts Provider A P I Provider Contract Tests 1) Pact auto-generates provider tests 3) Tests the provider Provider Contract Tests Provider Contract Tests 2) Set-up provider state Paulo Clavijo @pclavijo - January 2018
  • 18. Contract Testing on the Provider side Auto-generated Pact provider contract tests Paulo Clavijo @pclavijo - January 2018
  • 19. Paulo Clavijo @pclavijo - January 2018 Contract Testing on the Provider side Pact uses the state description on the contract to determine which set-up logic needs to be executed before running a generated test.
  • 20. Contract Testing on the Provider side Let’s implement a new end-point ...
  • 21. Contract Testing on the Provider side Let’s implement a new end-point ...
  • 22. Contract Testing on the Provider side Tests fail when changes in Provider impacts a Consumer
  • 23. Flexible Matching Pact provides flexible matching by regular expressions or type. Paulo Clavijo @pclavijo - January 2018
  • 24. Defining Interactions When we define the expected interactions between a consumer and a provider, the ‘state’ and ‘uponReceiving’ descriptions used should be written in a consistent style. Later on, on the provider side, Pact uses the uponReceiving description to name the auto-generated test, and the state description is used to find a corresponding test state. // Expected Interaction provider.addInteraction({ state: 'a task with id task-id exists', uponReceiving: 'a request to delete task task-id', withRequest: {method: 'DELETE', path: '/tasks/task-id'}, willRespondWith: {status: 204} }); Paulo Clavijo @pclavijo - January 2018
  • 25. Defining Interactions Examples Successful interaction where data is returned state: ‘tasks for project with id project-id exist’, uponReceiving: ‘a request to get tasks for that project’ Successful interaction where no data is returned state: ‘tasks for project with id project-id do not exist’, uponReceiving: ‘a request to get tasks for that project’ 404 error interaction state: ‘project project-id does not exist’, uponReceiving: ‘a request to get tasks for that project’ Domain validation error interaction state: ‘a task task-id exists and domain rules exist that prevent its modification’, uponReceiving: ‘a request to update that task’ Successful interaction where data is created state: ‘a project with name project-1 does not exist’, uponReceiving: ‘a request to create a project with name project-1’ Paulo Clavijo @pclavijo - January 2018
  • 26. Live Documentation Contracts are not only used by the tests, we also intent them to be user-friendly. Developers can consult contracts in the Pact Broker who shows them in a nice documentation style. Paulo Clavijo @pclavijo - January 2018
  • 27. CDC in our pipeline Paulo Clavijo @pclavijo - January 2018
  • 28. CDC vs Contract Tests TDD is more than having Unit Tests … … CDC is more than having Contract Tests Think in it as Outside-In TDD for a whole system! Is what we do, a technique and attitude, discipline on the design and development flow. Paulo Clavijo @pclavijo - January 2018
  • 29. What is next? ● Pact v3 ○ Contract testing for messages (for services that communicate via event streams and message queues) ● Pact v4 ○ Matching times and dates in a cross-platform manner ○ Additional Matchers ● … Beyond REST APIs. GraphQL? ○ Servers publish a statically typed system specific to their application, and GraphQL provides a unified language to query data within the constraints of that type system. Paulo Clavijo @pclavijo - January 2018
  • 30. Further reading ● Implementing Consumer-Driven Contract tests in Angular, Paulo Clavijo https://paucls.wordpress.com/2017/08/04/pact-consumer-driven-contract-imple mentation-in-angular ● Configure Pact JS Consumer Contract tests in Angular, Paulo Clavijo https://paucls.wordpress.com/2017/08/04/configure-pact-js-consumer-contract- tests-in-angular ● Sample project on Provider Side https://github.com/paucls/task_list_api-kotlin-pact Paulo Clavijo @pclavijo - January 2018
  • 31. References ● ContractTest, Martin Fowler. https://martinfowler.com/bliki/ContractTest.html ● Pact documentation https://docs.pact.io/documentation/implementation_guides.html ● Testing Strategies in a Microservice Architecture, Toby Clemson https://martinfowler.com/articles/microservice-testing/ ● Integrated Tests Are A Scam, J.B. Rainsberger http://blog.thecodewhisperer.com/permalink/integrated-tests-are-a-scam ● Consumer-Driven Contracts: A Service Evolution Pattern, Ian Robinson https://www.martinfowler.com/articles/consumerDrivenContracts.html ● Microservices, Flexible Software Architecture. Eberhard Wolff. ● Contract testing with GraphQL, Andreas Marek https://www.andimarek.com/post/contract-testing-graphql ● https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-junit Paulo Clavijo @pclavijo - January 2018
  • 32. Consumer-Driven Contract Testing Implementing a scalable testing strategy for Microservices Paulo Clavijo Esteban @pclavijo - January 2018