SlideShare uma empresa Scribd logo
1 de 37
Baixar para ler offline
Effective
Consumer-Driven
Contracts
Presented by
Preetham M
Head of Product - Core
Agenda
1 API as a product
2 Microservices
3 Problem statement
4 Consumer-driven contract testing
5 How do we do it at Postman?
HEAD OF PRODUCT-CORE, POSTMAN
Preetham
M
@getpostman
● APIs drive business
● Consumer-centric design
● Public APIs are nurtured and maintained better
● APIs are products irrespective of the sphere of influence
API as a Product
Microservices is an architectural style that structures an application as a
collection of services that are:
● Highly maintainable and testable
● Loosely coupled
● Independently deployable
● Organized around business capabilities
● Owned by a small team
The microservice architecture enables the rapid, frequent, and reliable
delivery of large, complex applications. It also enables an organization to
evolve its technology stack.
Microservices
Costs
● Distribution
● Eventual Consistency
● Operational Complexity
Microservices
Dependency Hell
Dependency hell is a colloquial term for the frustration of some software
users who have installed software packages which have dependencies on
specific versions of other software packages.
Dependency Hell
Signals and symptoms
● One service fails, all fail
● All services need to be deployed
together
● Services can’t evolve because of
shared databases or intertwined
schemas
● Not microservices, but a Distributed
Monolith
● A Monolith with all the costs of
microservices!
Costs
● Distribution
● Eventual Consistency
● Operational Complexity
Microservices
● Microservices introduce eventual consistency issues because of the
insistence on decentralized data management.
● Monoliths: Single transaction. Microservices: Multiple resources need
to update.
● Developers need to be aware of consistency issues.
● Maintaining strong consistency is extremely difficult for a distributed
system, which means everyone has to manage eventual consistency.
Eventual Consistency
● Puts additional strain on operations with hundreds of little
microservices.
● Continuous Delivery: Essential in a microservices setup.
● Danger complexity shifts to the interconnection between services.
● You need a mature operations team to manage lots of services, which
are being redeployed regularly.
Operational Complexity
Fallacies of distributed computing:
● The network is reliable.
● Latency is zero.
● Bandwidth is infinite.
● The network is secure.
● Topology doesn't change.
● There is one administrator.
● Transport cost is zero.
● The network is homogeneous.
Distribution
Distribution
● Developing microservices is easy,
but making sure you build a reliable
system is hard, very hard.
● A distributed system shifts the focus
from the node to the edges.
● It’s hard to:
○ evolve services
independently
○ know which services are
communicating with each
other
In a monolithic
world…
In a microservices
world…
Principles of
Microservices Design
Microservice
Communication
● Provider creates a contract to any
consumer that wants to use the API.
● This is how you “can” and “should”
use my API.
● Responsibility of the provider to
ensure any changes to the service
do not breach their own contract.
● But how do we know when there’s a
breaking change?
API Versioning
● A new API version per release
● Is that scalable?
Consumer-Driven
Contracts
● API consumer writes contracts to
test an API.
● This contract defines expectations
set by the consumer.
● This is how I am using the API.
● The Consumer can test only the
endpoints and properties it needs.
Consumer-Driven
Contracts
● Consumer-driven contracts are a
pattern for evolving services.
● Each consumer captures their
expectations of the provider in a
separate contract.
● All of these contracts are shared
with the provider so they gain
insight into the obligations they
must fulfill for each individual
consumer.
● The contract between services needs to be explicit and executable.
● Execute the expectations against multiple consumers and if one of
them breaks, you know exactly which consumer you’ve broken.
● Independent isolated testing of a service that allows you to go to
production without the need for big end-to-end testing.
Consumer First
● A test of business logic. That should be covered by your service’s unit
tests.
● A service-level agreement (SLA) between services.
● A system to validate external APIs service responses.
What a Contract Test Isn’t?
● A consistent format to describe requests and responses between
provider and consumer.
● An easy way to create contracts.
● A way of storing the created contracts.
● A way to test the services against the contracts, in an automated way.
● A way of running these tests locally.
● A way to manage the evolution of these contracts.
Consumer-Driven Contract Tooling:
How Do You Stay Agile with
Consumer-Driven Contracts
APIs in Postman
Collections
● Executable specifications of an API
● Auto-generated documentation
● Collaboratively editable in
Workspaces
● Collections can be run anywhere:
locally, commandline, CI, or cloud
● Simple log retrieval service
● 1 endpoint: Returns list of last 5 log entries
● 2 consumer
Example Use Case
API Definition
Can use collections/APIs
Documentation
Mock Servers
Consumer Contracts
Consumer Contracts
Stages of Implementing
Consumer-Driven Contracts
Continuous Testing
● Use Postman API to fetch all the contracts of the a particular API.
● Use Newman to run all consumer contract collections of a service on
each change.
● Use Monitors to keep testing services periodically.
API Versioning
● Sometimes you have to break contracts. How do you do that without
impacting consumers?
● API versioning
● Co-existing endpoints
● Co-existing service versions
● Should be clearly communicated to the consumers
Next Steps
Download the Economic Benefits Report
https://www.postman.com/postman-economics-report/
Thank You
postman.com @getpostman

Mais conteúdo relacionado

Mais procurados

API Security - Everything You Need to Know To Protect Your APIs
API Security - Everything You Need to Know To Protect Your APIsAPI Security - Everything You Need to Know To Protect Your APIs
API Security - Everything You Need to Know To Protect Your APIs
AaronLieberman5
 

Mais procurados (20)

Belajar Postman test runner
Belajar Postman test runnerBelajar Postman test runner
Belajar Postman test runner
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
 
Apigee Products Overview
Apigee Products OverviewApigee Products Overview
Apigee Products Overview
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architecture
 
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) PipelineAnatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
 
Api Testing
Api TestingApi Testing
Api Testing
 
Rest assured
Rest assuredRest assured
Rest assured
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
 
API Security Best Practices & Guidelines
API Security Best Practices & GuidelinesAPI Security Best Practices & Guidelines
API Security Best Practices & Guidelines
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
 
Microservices, DevOps & SRE
Microservices, DevOps & SREMicroservices, DevOps & SRE
Microservices, DevOps & SRE
 
API Security - Everything You Need to Know To Protect Your APIs
API Security - Everything You Need to Know To Protect Your APIsAPI Security - Everything You Need to Know To Protect Your APIs
API Security - Everything You Need to Know To Protect Your APIs
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
 
Introduction to Spring Cloud
Introduction to Spring Cloud           Introduction to Spring Cloud
Introduction to Spring Cloud
 
API Testing Presentations.pptx
API Testing Presentations.pptxAPI Testing Presentations.pptx
API Testing Presentations.pptx
 
Microservice vs. Monolithic Architecture
Microservice vs. Monolithic ArchitectureMicroservice vs. Monolithic Architecture
Microservice vs. Monolithic Architecture
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
 
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
 

Semelhante a Consumer-Driven Contract Testing With Postman

Semelhante a Consumer-Driven Contract Testing With Postman (20)

Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservices
 
Ato Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by SystangoAto Z of Microservices Architecture by Systango
Ato Z of Microservices Architecture by Systango
 
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
 
MuleSoft Manchester Meetup #4 slides 11th February 2021
MuleSoft Manchester Meetup #4 slides 11th February 2021MuleSoft Manchester Meetup #4 slides 11th February 2021
MuleSoft Manchester Meetup #4 slides 11th February 2021
 
Service-Mesh-Presentation.pdf
Service-Mesh-Presentation.pdfService-Mesh-Presentation.pdf
Service-Mesh-Presentation.pdf
 
Service Mesh Talk for CTO Forum
Service Mesh Talk for CTO ForumService Mesh Talk for CTO Forum
Service Mesh Talk for CTO Forum
 
Ledingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in actionLedingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in action
 
Testing Microservices
Testing MicroservicesTesting Microservices
Testing Microservices
 
Microservices-101
Microservices-101Microservices-101
Microservices-101
 
Concept of SOA
Concept of SOAConcept of SOA
Concept of SOA
 
Consumer contract testing
Consumer contract testingConsumer contract testing
Consumer contract testing
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
Consumer driven Contract Test
Consumer driven Contract TestConsumer driven Contract Test
Consumer driven Contract Test
 
Business Technology Brief
Business Technology BriefBusiness Technology Brief
Business Technology Brief
 
Intro to Microservices Architecture
Intro to Microservices ArchitectureIntro to Microservices Architecture
Intro to Microservices Architecture
 
Microservice Workshop Hands On
Microservice Workshop Hands On Microservice Workshop Hands On
Microservice Workshop Hands On
 
Introduction to Microservices.pdf
Introduction to Microservices.pdfIntroduction to Microservices.pdf
Introduction to Microservices.pdf
 
Migrating from a monolith to microservices – is it worth it?
Migrating from a monolith to microservices – is it worth it?Migrating from a monolith to microservices – is it worth it?
Migrating from a monolith to microservices – is it worth it?
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architecture
 
Automating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupAutomating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native Meetup
 

Mais de Postman

Discovering Public APIs and Public API Network with Postman
Discovering Public APIs and Public API Network with PostmanDiscovering Public APIs and Public API Network with Postman
Discovering Public APIs and Public API Network with Postman
Postman
 
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Optimizing Teamwork: Harnessing Collections & Workspaces for CollaborationOptimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Postman
 

Mais de Postman (20)

Elevating Developer Experiences with AI-Powered API Testing & Documentation
Elevating Developer Experiences with AI-Powered API Testing & DocumentationElevating Developer Experiences with AI-Powered API Testing & Documentation
Elevating Developer Experiences with AI-Powered API Testing & Documentation
 
Discovering Public APIs and Public API Network with Postman
Discovering Public APIs and Public API Network with PostmanDiscovering Public APIs and Public API Network with Postman
Discovering Public APIs and Public API Network with Postman
 
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Optimizing Teamwork: Harnessing Collections & Workspaces for CollaborationOptimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
 
API testing Beyond the Basics AI & Automation Techniques
API testing Beyond the Basics AI & Automation TechniquesAPI testing Beyond the Basics AI & Automation Techniques
API testing Beyond the Basics AI & Automation Techniques
 
Not Your Grandma’s Rate Limiting (slides)
Not Your Grandma’s Rate Limiting (slides)Not Your Grandma’s Rate Limiting (slides)
Not Your Grandma’s Rate Limiting (slides)
 
Five Ways to Automate API Testing with Postman
Five Ways to Automate API Testing with PostmanFive Ways to Automate API Testing with Postman
Five Ways to Automate API Testing with Postman
 
How to Scale APIs-as-Product for Future Success
How to Scale APIs-as-Product for Future SuccessHow to Scale APIs-as-Product for Future Success
How to Scale APIs-as-Product for Future Success
 
Revolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with PostmanRevolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with Postman
 
Everything You Always Wanted to Know About AsyncAPI
Everything You Always Wanted to Know About AsyncAPIEverything You Always Wanted to Know About AsyncAPI
Everything You Always Wanted to Know About AsyncAPI
 
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
 
Five Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
 
Integration-, Snapshot- and Performance-Testing APIs
Integration-, Snapshot- and Performance-Testing APIs Integration-, Snapshot- and Performance-Testing APIs
Integration-, Snapshot- and Performance-Testing APIs
 
How ChatGPT led OpenAPI's Recent Spike in Popularity
How ChatGPT led OpenAPI's Recent Spike in PopularityHow ChatGPT led OpenAPI's Recent Spike in Popularity
How ChatGPT led OpenAPI's Recent Spike in Popularity
 
Exploring Postman’s VS Code Extension
Exploring Postman’s VS Code ExtensionExploring Postman’s VS Code Extension
Exploring Postman’s VS Code Extension
 
2023 State of the API Report: Key Findings and Trends
2023 State of the API Report: Key Findings and Trends2023 State of the API Report: Key Findings and Trends
2023 State of the API Report: Key Findings and Trends
 
Nordic- APIOps is here What will you build in an API First World
Nordic- APIOps is here What will you build in an API First World Nordic- APIOps is here What will you build in an API First World
Nordic- APIOps is here What will you build in an API First World
 
Testing and Developing gRPC APIs
Testing and Developing gRPC APIsTesting and Developing gRPC APIs
Testing and Developing gRPC APIs
 
Testing and Developing GraphQL APIs
Testing and Developing GraphQL APIsTesting and Developing GraphQL APIs
Testing and Developing GraphQL APIs
 
Introduction to API Security - Intergalactic
Introduction to API Security - IntergalacticIntroduction to API Security - Intergalactic
Introduction to API Security - Intergalactic
 
Unboxing What's New in Postman Q2
Unboxing What's New in Postman Q2Unboxing What's New in Postman Q2
Unboxing What's New in Postman Q2
 

Último

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
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
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
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+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
 

Último (20)

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
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
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
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
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
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory 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
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
+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...
 

Consumer-Driven Contract Testing With Postman

  • 2. Agenda 1 API as a product 2 Microservices 3 Problem statement 4 Consumer-driven contract testing 5 How do we do it at Postman?
  • 3. HEAD OF PRODUCT-CORE, POSTMAN Preetham M @getpostman
  • 4. ● APIs drive business ● Consumer-centric design ● Public APIs are nurtured and maintained better ● APIs are products irrespective of the sphere of influence API as a Product
  • 5. Microservices is an architectural style that structures an application as a collection of services that are: ● Highly maintainable and testable ● Loosely coupled ● Independently deployable ● Organized around business capabilities ● Owned by a small team The microservice architecture enables the rapid, frequent, and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack. Microservices
  • 6. Costs ● Distribution ● Eventual Consistency ● Operational Complexity Microservices
  • 7. Dependency Hell Dependency hell is a colloquial term for the frustration of some software users who have installed software packages which have dependencies on specific versions of other software packages.
  • 8. Dependency Hell Signals and symptoms ● One service fails, all fail ● All services need to be deployed together ● Services can’t evolve because of shared databases or intertwined schemas ● Not microservices, but a Distributed Monolith ● A Monolith with all the costs of microservices!
  • 9. Costs ● Distribution ● Eventual Consistency ● Operational Complexity Microservices
  • 10. ● Microservices introduce eventual consistency issues because of the insistence on decentralized data management. ● Monoliths: Single transaction. Microservices: Multiple resources need to update. ● Developers need to be aware of consistency issues. ● Maintaining strong consistency is extremely difficult for a distributed system, which means everyone has to manage eventual consistency. Eventual Consistency
  • 11. ● Puts additional strain on operations with hundreds of little microservices. ● Continuous Delivery: Essential in a microservices setup. ● Danger complexity shifts to the interconnection between services. ● You need a mature operations team to manage lots of services, which are being redeployed regularly. Operational Complexity
  • 12. Fallacies of distributed computing: ● The network is reliable. ● Latency is zero. ● Bandwidth is infinite. ● The network is secure. ● Topology doesn't change. ● There is one administrator. ● Transport cost is zero. ● The network is homogeneous. Distribution
  • 13. Distribution ● Developing microservices is easy, but making sure you build a reliable system is hard, very hard. ● A distributed system shifts the focus from the node to the edges. ● It’s hard to: ○ evolve services independently ○ know which services are communicating with each other
  • 17. Microservice Communication ● Provider creates a contract to any consumer that wants to use the API. ● This is how you “can” and “should” use my API. ● Responsibility of the provider to ensure any changes to the service do not breach their own contract. ● But how do we know when there’s a breaking change?
  • 18. API Versioning ● A new API version per release ● Is that scalable?
  • 19. Consumer-Driven Contracts ● API consumer writes contracts to test an API. ● This contract defines expectations set by the consumer. ● This is how I am using the API. ● The Consumer can test only the endpoints and properties it needs.
  • 20. Consumer-Driven Contracts ● Consumer-driven contracts are a pattern for evolving services. ● Each consumer captures their expectations of the provider in a separate contract. ● All of these contracts are shared with the provider so they gain insight into the obligations they must fulfill for each individual consumer.
  • 21. ● The contract between services needs to be explicit and executable. ● Execute the expectations against multiple consumers and if one of them breaks, you know exactly which consumer you’ve broken. ● Independent isolated testing of a service that allows you to go to production without the need for big end-to-end testing. Consumer First
  • 22. ● A test of business logic. That should be covered by your service’s unit tests. ● A service-level agreement (SLA) between services. ● A system to validate external APIs service responses. What a Contract Test Isn’t?
  • 23. ● A consistent format to describe requests and responses between provider and consumer. ● An easy way to create contracts. ● A way of storing the created contracts. ● A way to test the services against the contracts, in an automated way. ● A way of running these tests locally. ● A way to manage the evolution of these contracts. Consumer-Driven Contract Tooling:
  • 24. How Do You Stay Agile with Consumer-Driven Contracts
  • 26. Collections ● Executable specifications of an API ● Auto-generated documentation ● Collaboratively editable in Workspaces ● Collections can be run anywhere: locally, commandline, CI, or cloud
  • 27. ● Simple log retrieval service ● 1 endpoint: Returns list of last 5 log entries ● 2 consumer Example Use Case
  • 28. API Definition Can use collections/APIs
  • 34. Continuous Testing ● Use Postman API to fetch all the contracts of the a particular API. ● Use Newman to run all consumer contract collections of a service on each change. ● Use Monitors to keep testing services periodically.
  • 35. API Versioning ● Sometimes you have to break contracts. How do you do that without impacting consumers? ● API versioning ● Co-existing endpoints ● Co-existing service versions ● Should be clearly communicated to the consumers
  • 36. Next Steps Download the Economic Benefits Report https://www.postman.com/postman-economics-report/