SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
@michikuehne
TDD for APIs
in a Microservice World
Michael Kuehne-Schlinkert
Head of Development @ Cybus
@michikuehne
Cybus brings untapped Data Sources to a secure API
Access Control

Pre-Processing & API
Shopfloor Protocols
Security
Monitoring
 Maintenance
Efficiency
 Sovereignty
@michikuehne
Our Challenges
  Security, Reliability & Scalability è Service Level Agreements 
Better Representation of Customer Needs through Tests & Codes
Loosly coupled but highly connected Microservices
Efficient TDD with limited resources
@michikuehne
„How to validate that our API is working
as intended?“
by Steve Klabnik
@michikuehne
„How to efficiently validate that our
microservice ecosystem is working as
intended?“
by Michael Kuehne-Schlinkert
@michikuehne
Simplified Ecosystem
Device
Service
Data {...}
Data{...}
Data{...}
UI
Service
Auth
Service
@michikuehne
Where to start?
Story
  As a <role>, 
__.I want <feature>
__.so that <reason>.



Example
__.As an admin of the cybus middleware
__.I want to control the read access to my devices
__.so that users can only read the data they are allowed to

Scenario
  GIVEN <context> 
__.WHEN <event>
__.THEN <outcome>



Example
__. GIVEN External Device
__. GIVEN Device Service
__. GIVEN Auth Service
__. WHEN External Device provides new data
__. WHEN Read Access to Device is granted
__. THEN Device Service reads data from external device
@michikuehne
Test Scenario
Device
Service
Data {...}
Data{...}
Data{...}
UI
Service
Auth
Service
External
Device
Data{...}
Stubbed
@michikuehne
Acceptance Tests
Platform Tests
  Turn Scenarios into Tests
  Focus on whole Microservice Ecosystem
Verify Functionality of Ecosystem
External / Third-Party Services are stubbed/mocked
  Black Box Testing
  Entry Point of Platform Test depends on Scenario
  API
  GUI

Contract Tests
  Turn API Specifications into Tests
  Focus on only One Mircroservice
Verify the Interface (Contract)
  Black Box Testing
@michikuehne
Integration Tests
A.k.a. Component Tests & Service Tests
  Focus on only One Microservice
Verify Functionality of One Service
  Break down Scenarios
  End-to-End Tests – but not to end of ecosystem
  Internal Services are stubbed/mocked
  Gray Box Testing (Black & White)

Resources
Domain
ORM
External
Client
Stubbed
Service
Ext. DB
Stb.
Test
Client


Simplified
Microservice
Architecture
@michikuehne
Functional Tests
Controller
Industrial
Protocol
Device
Handler
  Focus on 2+ Classes/Modules of Domain
Verify Interaction between Modules
  White Box Testing
  Internal Dependencies are stubbed/mocked

Example
Domain of
Microservice

Stubbed
@michikuehne
Unit Tests
Controller
Industrial
Protocol
Device
Handler
  Focus on One Unit (Class/Module) of Domain
Verify Functionality of One Unit
  Internal Dependencies are stubbed/mocked
  White Box Testing

Example
Domain of
Microservice

Stubbed
@michikuehne
Our TDD Cycle
Acceptance
Tests
Integration
Tests
Functional
Tests
Unit
Tests
Code
Black Box
 Gray Box
 White Box
@michikuehne
Our TDD Cycle with aspired Test Coverage
Acceptance
Tests
Integration
Tests
Functional
Tests
Unit
Tests
Code
tcU à 100%
tcI à 100%
 tcF à 100% - tcI
tcI + tcF à 100%
tcA à x%
tc = test coverage
x 
–
@michikuehne
Lessons Learned
It works! We overcame Testing Hell
Less Test Code and less Fragile Tests but high test coverage
  Quality of Story Definitions increased with mandatory Scenarios
Efficency comes with the right Tools
Each Microservice must provide Test Library (e.g. Stubs)
Deterministic Environments gained Complexity
Asynchronous Services require Gray to White Box Testing
Functional Tests became our Plan B
@michikuehne
cybus.io
@cybus_io
hello@cybus.io
Pssst! We‘re hiring!
Michael Kuehne-Schlinkert
@michikuehne
kuehne@cybus.io
Thx! ...and happy testing!
@michikuehne
Appendix
  Icons by Gregor Cresnar from www.flaticon.com is licensed by CC 3.0 BY
  Icons by Freepik from www.flaticon.com is licensed by CC 3.0 BY

Contenu connexe

Tendances

Digital Methods Winterschool 2012: API - Interfaces to the Cloud
Digital Methods Winterschool 2012: API - Interfaces to the CloudDigital Methods Winterschool 2012: API - Interfaces to the Cloud
Digital Methods Winterschool 2012: API - Interfaces to the Cloud
Digital Methods Initiative
 

Tendances (20)

Microsoft Skills Bootcamp - The power of GitHub and Azure
Microsoft Skills Bootcamp - The power of GitHub and AzureMicrosoft Skills Bootcamp - The power of GitHub and Azure
Microsoft Skills Bootcamp - The power of GitHub and Azure
 
Consumer-driven contracts with Pact and PHP
Consumer-driven contracts with Pact and PHPConsumer-driven contracts with Pact and PHP
Consumer-driven contracts with Pact and PHP
 
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
 
Test Automation Workshop with BDD Approach
Test Automation Workshop with BDD ApproachTest Automation Workshop with BDD Approach
Test Automation Workshop with BDD Approach
 
Spring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice ArchitectureSpring Cloud Contract And Your Microservice Architecture
Spring Cloud Contract And Your Microservice Architecture
 
Cloud-Native Streaming and Event-Driven Microservices
Cloud-Native Streaming and Event-Driven MicroservicesCloud-Native Streaming and Event-Driven Microservices
Cloud-Native Streaming and Event-Driven Microservices
 
Bulletproof Microservices with Spring and Kubernetes
Bulletproof Microservices with Spring and KubernetesBulletproof Microservices with Spring and Kubernetes
Bulletproof Microservices with Spring and Kubernetes
 
What does it take to be an architect
What does it take to be an architectWhat does it take to be an architect
What does it take to be an architect
 
Digital Methods Winterschool 2012: API - Interfaces to the Cloud
Digital Methods Winterschool 2012: API - Interfaces to the CloudDigital Methods Winterschool 2012: API - Interfaces to the Cloud
Digital Methods Winterschool 2012: API - Interfaces to the Cloud
 
vodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Consumer driven contract testing using pactvodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Consumer driven contract testing using pact
 
Distributed Tracing Velocity2016
Distributed Tracing Velocity2016Distributed Tracing Velocity2016
Distributed Tracing Velocity2016
 
What does it take to be architect (for Cjicago JUG)
What does it take to be architect (for Cjicago JUG)What does it take to be architect (for Cjicago JUG)
What does it take to be architect (for Cjicago JUG)
 
ATAGTR2017 Wearable App Testing
ATAGTR2017 Wearable App TestingATAGTR2017 Wearable App Testing
ATAGTR2017 Wearable App Testing
 
Is your kubernetes negative or positive
Is your kubernetes negative or positive Is your kubernetes negative or positive
Is your kubernetes negative or positive
 
Introducing OpenAPI Version 3.1
Introducing OpenAPI Version 3.1Introducing OpenAPI Version 3.1
Introducing OpenAPI Version 3.1
 
Testing Microservices
Testing MicroservicesTesting Microservices
Testing Microservices
 
ATAGTR2017 Expanding test horizons with Robot Framework
ATAGTR2017 Expanding test horizons with Robot FrameworkATAGTR2017 Expanding test horizons with Robot Framework
ATAGTR2017 Expanding test horizons with Robot Framework
 
Next-Generation Cloud Native Apps with Spring Cloud and Kubernetes
Next-Generation Cloud Native Apps with Spring Cloud and KubernetesNext-Generation Cloud Native Apps with Spring Cloud and Kubernetes
Next-Generation Cloud Native Apps with Spring Cloud and Kubernetes
 
Secure your applications with Azure AD and Key Vault
Secure your applications with Azure AD and Key VaultSecure your applications with Azure AD and Key Vault
Secure your applications with Azure AD and Key Vault
 
Contract Testing
Contract TestingContract Testing
Contract Testing
 

En vedette

El valor de las vitaminas d y e
El valor de las vitaminas d y eEl valor de las vitaminas d y e
El valor de las vitaminas d y e
EveliaeS
 
Manual pag (1)
Manual pag (1)Manual pag (1)
Manual pag (1)
morth18
 
Trabajo sobre internet
Trabajo sobre internetTrabajo sobre internet
Trabajo sobre internet
lydiayalba
 
Tarea 3
Tarea 3Tarea 3
Tarea 3
piesfe
 
Problemáticas intraurbanas 5c
Problemáticas intraurbanas 5cProblemáticas intraurbanas 5c
Problemáticas intraurbanas 5c
florzhita
 

En vedette (20)

Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 
La Ciencia y la Medicina
La Ciencia y la Medicina La Ciencia y la Medicina
La Ciencia y la Medicina
 
Pedro jose nieves m enlace prezi actividad 3
Pedro jose nieves m  enlace prezi actividad 3Pedro jose nieves m  enlace prezi actividad 3
Pedro jose nieves m enlace prezi actividad 3
 
Обучающая презентация для детей "Жизнь в лесу"
Обучающая презентация для детей "Жизнь в лесу"Обучающая презентация для детей "Жизнь в лесу"
Обучающая презентация для детей "Жизнь в лесу"
 
Eleva tu capacidad como líder
Eleva tu capacidad como líderEleva tu capacidad como líder
Eleva tu capacidad como líder
 
MWDN_General brochure
MWDN_General brochureMWDN_General brochure
MWDN_General brochure
 
De ce FJSC?
De ce FJSC?De ce FJSC?
De ce FJSC?
 
spring bed dan harga
spring bed dan harga spring bed dan harga
spring bed dan harga
 
El valor de las vitaminas d y e
El valor de las vitaminas d y eEl valor de las vitaminas d y e
El valor de las vitaminas d y e
 
Habilidades digitales para el gestor de una empresa internacional (extracto)
Habilidades digitales para el gestor de una empresa internacional (extracto)Habilidades digitales para el gestor de una empresa internacional (extracto)
Habilidades digitales para el gestor de una empresa internacional (extracto)
 
Slideshare
SlideshareSlideshare
Slideshare
 
Manual pag (1)
Manual pag (1)Manual pag (1)
Manual pag (1)
 
Los ángeles de las aceras
Los ángeles de las acerasLos ángeles de las aceras
Los ángeles de las aceras
 
Diccionario de arte, 1887 vocabulario de tã£â©rminos de arte
Diccionario de arte, 1887 vocabulario de tã£â©rminos de arteDiccionario de arte, 1887 vocabulario de tã£â©rminos de arte
Diccionario de arte, 1887 vocabulario de tã£â©rminos de arte
 
P001 020 ma-lessonsintro rnc
P001 020 ma-lessonsintro rncP001 020 ma-lessonsintro rnc
P001 020 ma-lessonsintro rnc
 
Espirales
EspiralesEspirales
Espirales
 
Trabajo sobre internet
Trabajo sobre internetTrabajo sobre internet
Trabajo sobre internet
 
Tarea 3
Tarea 3Tarea 3
Tarea 3
 
Problemáticas intraurbanas 5c
Problemáticas intraurbanas 5cProblemáticas intraurbanas 5c
Problemáticas intraurbanas 5c
 
spring bed guhdo no 1
spring bed guhdo no 1spring bed guhdo no 1
spring bed guhdo no 1
 

Similaire à TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlinkert @ NordicAPIs Platform Summit 2016, Stockholm

Similaire à TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlinkert @ NordicAPIs Platform Summit 2016, Stockholm (20)

TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...
TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...
TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...
 
Performance Metrics Driven CI/CD - Introduction to Continuous Innovation and ...
Performance Metrics Driven CI/CD - Introduction to Continuous Innovation and ...Performance Metrics Driven CI/CD - Introduction to Continuous Innovation and ...
Performance Metrics Driven CI/CD - Introduction to Continuous Innovation and ...
 
Microservices
MicroservicesMicroservices
Microservices
 
Service Virtualization: What, Who, When, and How
Service Virtualization: What, Who, When, and HowService Virtualization: What, Who, When, and How
Service Virtualization: What, Who, When, and How
 
New ThousandEyes Product Features and Release Highlights: June 2023
New ThousandEyes Product Features and Release Highlights: June 2023New ThousandEyes Product Features and Release Highlights: June 2023
New ThousandEyes Product Features and Release Highlights: June 2023
 
Microservices: Architecture for Agile Software Development
Microservices: Architecture for Agile Software DevelopmentMicroservices: Architecture for Agile Software Development
Microservices: Architecture for Agile Software Development
 
Microservices
MicroservicesMicroservices
Microservices
 
Software Architecture for Innovation
Software Architecture for InnovationSoftware Architecture for Innovation
Software Architecture for Innovation
 
Baltimore jan2019 mule4
Baltimore jan2019 mule4Baltimore jan2019 mule4
Baltimore jan2019 mule4
 
Architecting Microservices in .Net
Architecting Microservices in .NetArchitecting Microservices in .Net
Architecting Microservices in .Net
 
SV Training Intro - 20181129 4.pptx
SV Training Intro - 20181129 4.pptxSV Training Intro - 20181129 4.pptx
SV Training Intro - 20181129 4.pptx
 
170215 msa intro
170215 msa intro170215 msa intro
170215 msa intro
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
 
Keys to continuous testing for faster delivery euro star webinar
Keys to continuous testing for faster delivery euro star webinar Keys to continuous testing for faster delivery euro star webinar
Keys to continuous testing for faster delivery euro star webinar
 
ISTIO Deep Dive
ISTIO Deep DiveISTIO Deep Dive
ISTIO Deep Dive
 
Modernizing Testing as Apps Re-Architect
Modernizing Testing as Apps Re-ArchitectModernizing Testing as Apps Re-Architect
Modernizing Testing as Apps Re-Architect
 
#ATAGTR2019 Presentation "AIML Driven extensive reusable Automation Asset Man...
#ATAGTR2019 Presentation "AIML Driven extensive reusable Automation Asset Man...#ATAGTR2019 Presentation "AIML Driven extensive reusable Automation Asset Man...
#ATAGTR2019 Presentation "AIML Driven extensive reusable Automation Asset Man...
 
DCSF19 Adding a Modern API Layer to ‘Dockerized’ Legacy Apps
DCSF19 Adding a Modern API Layer to ‘Dockerized’ Legacy Apps  DCSF19 Adding a Modern API Layer to ‘Dockerized’ Legacy Apps
DCSF19 Adding a Modern API Layer to ‘Dockerized’ Legacy Apps
 
Migrating to Microservices Patterns and Technologies (edition 2023)
 Migrating to Microservices Patterns and Technologies (edition 2023) Migrating to Microservices Patterns and Technologies (edition 2023)
Migrating to Microservices Patterns and Technologies (edition 2023)
 
New ThousandEyes Product Features and Release Highlights: July 2023
New ThousandEyes Product Features and Release Highlights: July 2023New ThousandEyes Product Features and Release Highlights: July 2023
New ThousandEyes Product Features and Release Highlights: July 2023
 

Dernier

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
anilsa9823
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
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
 
+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
 

Dernier (20)

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
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 🔝✔️✔️
 
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
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
+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...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlinkert @ NordicAPIs Platform Summit 2016, Stockholm