SlideShare a Scribd company logo
1 of 15
Download to read offline
Stick to the rules!
Consumer Driven Contracts
Marcin Grzejszczak @mgrzejszczak
Jakub Kubrynski @jkubrynski
Jakub
Kubryński
@jkubrynski
www.kubrynski.com
Marcin
Grzejszczak
@mgrzejszczak
toomuchcoding.blogspot.com
TDD on architectural level
@mgrzejszczak @jkubrynski
What is
Consumer Driven Contract
@mgrzejszczak @jkubrynski
● Server
● Consumer
● Contract
Consumer Driven Contract
benefits
@mgrzejszczak @jkubrynski
Example
@mgrzejszczak @jkubrynski
Example
@mgrzejszczak @jkubrynski
How to solve it
@mgrzejszczak @jkubrynski
● Consumer’s tests
● Server tests
Contract definition
@mgrzejszczak @jkubrynski
● Contract defines communication
● Your stub is your contract - verify it!
● Expose your stub to your consumers
Consumer Technology
@mgrzejszczak @jkubrynski
Wiremock
http://wiremock.org
testCompile 'com.github.tomakehurst:wiremock:1.53'
{
"request": {
"method": "GET",
"url": "/hello"
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": { "Content-Type": "text/plain" }
}
}
Server Technology
@mgrzejszczak @jkubrynski
Accurate REST
https://github.com/Codearte/accurest
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.codearte.accurest:accurest-gradle-plugin:0.5.0'
}
}
apply plugin: 'accurest'
Server Technology
@mgrzejszczak @jkubrynski
Accurate REST
def shouldMarkClientAsNotFraud() {
given:
def request = given()
.header('Content-Type', 'application/frud+json')
.body('{"clientPesel":"12345678901",
"loanAmount":123.123}')
when:
def response = given().spec(request)
.put("/fraudcheck")
then:
response.statusCode == 200
response.header('Content-Type') == 'application/fraud+json'
and:
def responseBody = parseText(response.body.asString())
responseBody.fraudCheckStatus == "OK"
}
Example
@mgrzejszczak @jkubrynski
Live coding
@mgrzejszczak @jkubrynski
Q&A
@mgrzejszczak @jkubrynski
github.com/marcingrzejszczak/4developers_cdc_examples

More Related Content

Similar to 4Developers 2015: Stick to the rules - Consumer Driven Contracts - Marcin Grzejszczak, Jakub Kubryński

Software contracts or: how I learned to stop worrying and love releasing. Agi...
Software contracts or: how I learned to stop worrying and love releasing. Agi...Software contracts or: how I learned to stop worrying and love releasing. Agi...
Software contracts or: how I learned to stop worrying and love releasing. Agi...
Seb Rose
 
Chicago Corrosion Group Brochure (Low Res)
Chicago Corrosion Group Brochure (Low Res)Chicago Corrosion Group Brochure (Low Res)
Chicago Corrosion Group Brochure (Low Res)
Karyn Byers
 

Similar to 4Developers 2015: Stick to the rules - Consumer Driven Contracts - Marcin Grzejszczak, Jakub Kubryński (17)

Micro-service delivery - without the pitfalls
Micro-service delivery - without the pitfallsMicro-service delivery - without the pitfalls
Micro-service delivery - without the pitfalls
 
Contract testing - Sealights 2022.pdf
Contract testing - Sealights 2022.pdfContract testing - Sealights 2022.pdf
Contract testing - Sealights 2022.pdf
 
TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for Microservices
 
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
 
Consumer driven contracts in java world
Consumer driven contracts in java worldConsumer driven contracts in java world
Consumer driven contracts in java world
 
Deploy With Certainty
Deploy With CertaintyDeploy With Certainty
Deploy With Certainty
 
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
Simulating APIs for Effective Testing: (Micro)Service Virtualisation for the ...
 
Software contracts or: how I learned to stop worrying and love releasing. Agi...
Software contracts or: how I learned to stop worrying and love releasing. Agi...Software contracts or: how I learned to stop worrying and love releasing. Agi...
Software contracts or: how I learned to stop worrying and love releasing. Agi...
 
Software contracts - Global Enterprise Agile 2023.pdf
Software contracts - Global Enterprise Agile 2023.pdfSoftware contracts - Global Enterprise Agile 2023.pdf
Software contracts - Global Enterprise Agile 2023.pdf
 
Api Simulation Patterns for Better Testing
Api Simulation Patterns for Better TestingApi Simulation Patterns for Better Testing
Api Simulation Patterns for Better Testing
 
Consumer Driven Contracts and Your Microservice Architecture @ Warsaw JUG
Consumer Driven Contracts and Your Microservice Architecture @ Warsaw JUGConsumer Driven Contracts and Your Microservice Architecture @ Warsaw JUG
Consumer Driven Contracts and Your Microservice Architecture @ Warsaw JUG
 
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
 
Testing RESTful Web Services
Testing RESTful Web ServicesTesting RESTful Web Services
Testing RESTful Web Services
 
Chicago Corrosion Group Brochure (Low Res)
Chicago Corrosion Group Brochure (Low Res)Chicago Corrosion Group Brochure (Low Res)
Chicago Corrosion Group Brochure (Low Res)
 
EMS RUSH PCB
EMS RUSH PCBEMS RUSH PCB
EMS RUSH PCB
 
Creando microservicios con Java y Microprofile - Nicaragua JUG
Creando microservicios con Java y Microprofile - Nicaragua JUGCreando microservicios con Java y Microprofile - Nicaragua JUG
Creando microservicios con Java y Microprofile - Nicaragua JUG
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 

4Developers 2015: Stick to the rules - Consumer Driven Contracts - Marcin Grzejszczak, Jakub Kubryński