Fake It Outside-In TDD @XP2017

David Völkel
David VölkelSoftware Developer and IT-Consultant um codecentric AG
FAKE IT OUTSIDE-IN TDD
David Völkel
24th May @ XP 2017
@DAVIDVOELKEL
@codecentric
@softwerkskammer
#TDD
INFLUENCES
2003 Kent Beck’s "Fake It" Pattern
2009 #GOOS’s "Outside-In" Design
2013 Emily Bache 

"Outside-In development with Double Loop TDD"
2014 Justin Searls "The Failures of 'Intro to TDD'"
COMBINATION
2015 Dimitry Polivaev Outside-In with faked Data
2016 SoCraTes DE Outside-In Fake It Session
2017 Refinement
INFLUENCES
2003 Kent Beck’s "Fake It" Pattern
2009 #GOOS’s "Outside-In" Design
2013 Emily Bache 

"Outside-In development with Double Loop TDD"
2014 Justin Searls "The Failures of 'Intro to TDD'"
COMBINATION
2015 Dimitry Polivaev Outside-In with faked Data
2016 SoCraTes DE Outside-In Fake It Session
2017 Refinement
INFLUENCES
2003 Kent Beck’s "Fake It" Pattern
2009 #GOOS’s "Outside-In" Design
COMBINATION
FAKE IT OUTSIDE-IN TDD
INFLUENCES
2003 Kent Beck’s "Fake It" Pattern
2009 #GOOS’s "Outside-In" Design
2013 Emily Bache 

"Outside-In development with Double Loop TDD"
2014 Justin Searls "The Failures of 'Intro to TDD'"
COMBINATION
2016 SoCraTes DE Outside-In Fake It Session
INFLUENCES
2003 Kent Beck’s "Fake It" Pattern
2009 #GOOS’s "Outside-In" Design
2013 Emily Bache 

"Outside-In development with Double Loop TDD"
2014 Justin Searls "The Failures of 'Intro to TDD'"
COMBINATION
2016 SoCraTes DE Outside-In Fake It Session
2017 Refinement / Work in Progress
INFLUENCES
2003 Kent Beck’s "Fake It" Pattern
2009 #GOOS’s "Outside-In" Design
2013 Emily Bache 

"Outside-In development with Double Loop TDD"
COMBINATION
2016 SoCraTes DE Outside-In Fake It Session
2017 Refinement / Work in Progress
INFLUENCES
2003 Kent Beck’s "Fake It" Pattern
2009 #GOOS’s "Outside-In" Design
2013 Emily Bache 

"Outside-In development with Double Loop TDD"
2014 Justin Searls "The Failures of 'Intro to TDD'"
COMBINATION
2016 SoCraTes DE Outside-In Fake It Session
2017 Refinement / Work in Progress
INFLUENCES
2003 Kent Beck’s "Fake It" Pattern
2009 #GOOS’s "Outside-In" Design
2013 Emily Bache 

"Outside-In development with Double Loop TDD"
2014 Justin Searls "The Failures of 'Intro to TDD'"
2017 Llewelyn Falco „Extreme: Fake it Till you Make It“
COMBINATION
2016 SoCraTes DE Outside-In Fake It Session
2017 Refinement / Work in Progress
AGENDA
Theory
Building Blocks
Fake It Outside-In
Practice
Mob Programming Session
Reflect
Trade-Offs
Discussion
BUILDING BLOCKS
INTEGRATION OPERATION
SEGREGATION PRINCIPLE
*"Integration Operation Segregation Principle", Ralf Westphal
"Die kniffligen Fälle beim Testen - Sichtbarkeit", Stefan Lieser
*
INTEGRATION OPERATION
SEGREGATION PRINCIPLE
public void sendDiscountMailingTo(String email) {
Customer customer = customerDB.findCustomerBy(email);
Account account = customer.account();
String discount = account == FREE ? "no" :
account == BASE ? "a 10%" :
account == PREMIUM ? "a 25%" :
"-ERROR-";
String content = "Hello " + customer.getName() + ",nn" +
"This week you get " + discount + " discount " +
"on all our products.nn" +
"Best Regards,n" + "ACME Customer Service";
mailService.sendMail(email, content);
}
OPERATION
public void sendDiscountMailingTo(String email) {
Customer customer = customerDB.findCustomerBy(email);
Account account = customer.account();
String discount = account == FREE ? "no" :
account == BASE ? "a 10%" :
account == PREMIUM ? "a 25%" :
"-ERROR-";
String content = "Hello " + customer.getName() + ",nn" +
"This week you get " + discount + " discount " +
"on all our products.nn" +
"Best Regards,n" + "ACME Customer Service";
mailService.sendMail(email, content);
}
INTEGRATION OPERATION
SEGREGATION PRINCIPLE
INTEGRATION
INTEGRATION
OPERATION
public void sendDiscountMailingTo(String email) {
Customer customer = customerDB.findCustomerBy(email);
Account account = customer.account();
String discount = account == FREE ? "no" :
account == BASE ? "a 10%" :
account == PREMIUM ? "a 25%" :
"-ERROR-";
String content = "Hello " + customer.getName() + ",nn" +
"This week you get " + discount + " discount " +
"on all our products.nn" +
"Best Regards,n" + "ACME Customer Service";
mailService.sendMail(email, content);
}
INTEGRATION OPERATION
SEGREGATION PRINCIPLE
INTEGRATION
INTEGRATION
OPERATION
public void sendDiscountMailingTo(String email) {
Customer customer = customerDB.findCustomerBy(email);
Account account = customer.account();
String discount = account == FREE ? "no" :
account == BASE ? "a 10%" :
account == PREMIUM ? "a 25%" :
"-ERROR-";
String content = "Hello " + customer.getName() + ",nn" +
"This week you get " + discount + " discount " +
"on all our products.nn" +
"Best Regards,n" + "ACME Customer Service";
mailService.sendMail(email, content);
}
INTEGRATION OPERATION
SEGREGATION PRINCIPLE
OPERATION
INTEGRATION
public void sendDiscountMailingTo(String email) {
Customer customer = customerDB.findCustomerBy(email);
String content = renderMessage(customer, customer.account());
mailService.sendMail(email, content);
}
private String renderMessage(Customer customer, Account account) {
String discount = account == FREE ? "no" :
account == BASE ? "a 10%" :
account == PREMIUM ? "a 25%" :
"-ERROR-";
return "Hello " + customer.getName() + ",nn" +
"This week you get " + discount + " discount " +
"on all our products.nn" +
"Best Regards,n" + "ACME Customer Service";
}
INTEGRATION OPERATION
SEGREGATION PRINCIPLE
public void sendDiscountMailingTo(String email) {
Customer customer = customerDB.findCustomerBy(email);
String content = renderMessage(customer, customer.account());
mailService.sendMail(email, content);
}
private String renderMessage(Customer customer, Account account) {
String discount = account == FREE ? "no" :
account == BASE ? "a 10%" :
account == PREMIUM ? "a 25%" :
"-ERROR-";
return "Hello " + customer.getName() + ",nn" +
"This week you get " + discount + " discount " +
"on all our products.nn" +
"Best Regards,n" + "ACME Customer Service";
}
TESTS?
OPERATION
public void sendDiscountMailingTo(String email) {
Customer customer = customerDB.findCustomerBy(email);
String content = renderMessage(customer, customer.account());
mailService.sendMail(email, content);
}
private String renderMessage(Customer customer, Account account) {
String discount = account == FREE ? "no" :
account == BASE ? "a 10%" :
account == PREMIUM ? "a 25%" :
"-ERROR-";
return "Hello " + customer.getName() + ",nn" +
"This week you get " + discount + " discount " +
"on all our products.nn" +
"Best Regards,n" + "ACME Customer Service";
}
TESTS?
N UNITTESTS
INTEGRATION
OPERATION
public void sendDiscountMailingTo(String email) {
Customer customer = customerDB.findCustomerBy(email);
String content = renderMessage(customer, customer.account());
mailService.sendMail(email, content);
}
private String renderMessage(Customer customer, Account account) {
String discount = account == FREE ? "no" :
account == BASE ? "a 10%" :
account == PREMIUM ? "a 25%" :
"-ERROR-";
return "Hello " + customer.getName() + ",nn" +
"This week you get " + discount + " discount " +
"on all our products.nn" +
"Best Regards,n" + "ACME Customer Service";
}
TESTS?1 INTEGRATION TEST
N UNITTESTS
GREEN BAR PATTERNS*
Obvious Implementation
Fake it (until you make it)
Triangulation
* Kent Beck in "TDD by Example"
GREEN BAR PATTERNS
Obvious Implementation
Fake it
Triangulation
Trade-Off
Complexity
GREEN BAR PATTERNS
DEMO
SWEET SPOT
Logic
GREEN BAR PATTERNS
Obvious Implementation
Fake it
Triangulation
SWEET SPOT
Structure
Logic
GREEN BAR PATTERNS
Obvious Implementation
Fake it
Triangulation
SWEET SPOT
Trivial
Structure
Logic
GREEN BAR PATTERNS
Obvious Implementation
Fake it
Triangulation
INTEGRATION
OPERATION
Fake it
Triangulation
GREEN BAR PATTERNS
Structure
Logic
IOSP
PREPARATORY REFACTORINGS*
*"An example of preparatory refactoring", Martin Fowler
"GREEN" PHASE TRIANGULATION
Implementation Run Test
"Green Phase"
LIMIT YOUR TIME IN RED
"Green Phase"
Implementation Run Test
Implementation Run TestPreparatory Refactoring
PREPARATORY REFACTORINGS
DEMO
Acceptance Test
UI
Persistence
OUTSIDE-IN
Unit test
Mock
OUTSIDE-IN & MOCKS
Unit Test
OUTSIDE-IN & MOCKS
Acceptance Test
UI
Persistence
OUTSIDE-IN & MOCKS
Comprehensive
Acceptance Test
OUTSIDE-IN & FAKE IT
Comprehensive
Acceptance Test
Faked Result
OUTSIDE-IN & FAKE IT
Acceptance Test
Fake
Fake
OUTSIDE-IN & FAKE IT
Acceptance Test Drive Structure
through Refactoring
OUTSIDE-IN & FAKE IT
OUTSIDE-IN & FAKE IT
Acceptance Test
Unit Test
Fill logic with
triangulation
OUTSIDE-IN & FAKE IT
Acceptance Test Unit Test
OUTSIDE-IN & FAKE IT
INTEGRATION
Fake It
Triangulation
OPERATION
Start with
• comprehensive 

Acceptance Test
• faked result
Drive structure by refactoring
Drive logic by unit tests
OUTSIDE-IN & FAKE IT
INTEGRATION
Fake It
Triangulation
OPERATION
Start with
• comprehensive 

Acceptance Test
• faked result
Drive structure by refactoring
Drive logic by unit tests
DIAMOND KATA
FAKE IT OUTSIDE-IN
DEMO
FAKE-IT VARIANT
CALCULATE BACKWARDS
DEMO
PRACTICE
CODING SESSION
KATA
Continue Diamond Kata
https://github.com/davidvoelkel/diamond-kata
CONSTRAINTS
Drive structure by refactoring
Drive conditionals by triangulation
TRADE-OFFS
FAKE IT VS
OUTSIDE-IN & MOCKS
TRIANGULATION
CONDITIONAL INTERACTIONS
Mocking when IOSP not possible
public String signup(String username) throws Exception {
if(userDB.findUserBy(username) == null) {
userDB.createUser(new User(username));
return "Welcome " + username;
} else {
return "Username ' " + username + "' "
+ "already taken, please choose another";
}
}
COUPLING OUTSIDE-IN
Mocking Fake It
Decoupling Refactorability
DATA GUIDES STRUCTURE
Triangulation Fake It
Structure Cumbersome Data guides well
# BRANCHES
Triangulation Fake It
# N 1
More confidence
More effort
# BRANCHES
Triangulation Fake It
# N 1
Fake data easy to forget
Omitting cases is
tempting
TIME IN GREEN
Triangulation
Prep Refactoring
Triangulation
Fake It
DISCUSSION
LICENSE
Creative Commons Attribution-ShareAlike 3.0
IMAGES
Most are Public Domain except theses
Creative Commons with attributions:
"Unstruttalbrücke" by Störfix
From State Library of Queensland
1 von 59

Recomendados

Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019 von
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 2019Paulo Clavijo
262 views36 Folien
The lazy programmer's guide to writing thousands of tests von
The lazy programmer's guide to writing thousands of testsThe lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of testsScott Wlaschin
912 views105 Folien
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter... von
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Domenic Denicola
184.3K views99 Folien
Hexagonal architecture vs Functional core / Imperative shell von
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellThomas Pierrain
493 views48 Folien
Helm – The package manager for Kubernetes von
Helm – The package manager for KubernetesHelm – The package manager for Kubernetes
Helm – The package manager for KubernetesFabianRosenthal1
589 views28 Folien
How to test infrastructure code: automated testing for Terraform, Kubernetes,... von
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...Yevgeniy Brikman
33.8K views200 Folien

Más contenido relacionado

Was ist angesagt?

Choose your own adventure Chaos Engineering - QCon NYC 2017 von
Choose your own adventure Chaos Engineering - QCon NYC 2017 Choose your own adventure Chaos Engineering - QCon NYC 2017
Choose your own adventure Chaos Engineering - QCon NYC 2017 Nora Jones
1.4K views69 Folien
OO Design and Design Patterns in C++ von
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ Ganesh Samarthyam
1.9K views206 Folien
Sequence and Traverse - Part 2 von
Sequence and Traverse - Part 2Sequence and Traverse - Part 2
Sequence and Traverse - Part 2Philip Schwarz
3.2K views33 Folien
What you have to know about Certified Kubernetes Administrator (CKA) von
What you have to know about Certified Kubernetes Administrator (CKA)What you have to know about Certified Kubernetes Administrator (CKA)
What you have to know about Certified Kubernetes Administrator (CKA)Opsta
3.8K views17 Folien
Hacking Adobe Experience Manager sites von
Hacking Adobe Experience Manager sitesHacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sitesMikhail Egorov
13.2K views23 Folien
Kata: Hexagonal Architecture / Ports and Adapters von
Kata: Hexagonal Architecture / Ports and AdaptersKata: Hexagonal Architecture / Ports and Adapters
Kata: Hexagonal Architecture / Ports and Adaptersholsky
2.1K views7 Folien

Was ist angesagt?(20)

Choose your own adventure Chaos Engineering - QCon NYC 2017 von Nora Jones
Choose your own adventure Chaos Engineering - QCon NYC 2017 Choose your own adventure Chaos Engineering - QCon NYC 2017
Choose your own adventure Chaos Engineering - QCon NYC 2017
Nora Jones1.4K views
OO Design and Design Patterns in C++ von Ganesh Samarthyam
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
Ganesh Samarthyam1.9K views
Sequence and Traverse - Part 2 von Philip Schwarz
Sequence and Traverse - Part 2Sequence and Traverse - Part 2
Sequence and Traverse - Part 2
Philip Schwarz3.2K views
What you have to know about Certified Kubernetes Administrator (CKA) von Opsta
What you have to know about Certified Kubernetes Administrator (CKA)What you have to know about Certified Kubernetes Administrator (CKA)
What you have to know about Certified Kubernetes Administrator (CKA)
Opsta3.8K views
Hacking Adobe Experience Manager sites von Mikhail Egorov
Hacking Adobe Experience Manager sitesHacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sites
Mikhail Egorov13.2K views
Kata: Hexagonal Architecture / Ports and Adapters von holsky
Kata: Hexagonal Architecture / Ports and AdaptersKata: Hexagonal Architecture / Ports and Adapters
Kata: Hexagonal Architecture / Ports and Adapters
holsky2.1K views
Railway Oriented Programming von Scott Wlaschin
Railway Oriented ProgrammingRailway Oriented Programming
Railway Oriented Programming
Scott Wlaschin639.8K views
Hexagonal architecture with Spring Boot von Mikalai Alimenkou
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring Boot
Mikalai Alimenkou8.8K views
Dynamic Components using Single-Page-Application Concepts in AEM/CQ von Netcetera
Dynamic Components using Single-Page-Application Concepts in AEM/CQDynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
Netcetera5.2K views
Defending against Java Deserialization Vulnerabilities von Luca Carettoni
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization Vulnerabilities
Luca Carettoni18.4K views
Chaos Engineering: Why the World Needs More Resilient Systems von C4Media
Chaos Engineering: Why the World Needs More Resilient SystemsChaos Engineering: Why the World Needs More Resilient Systems
Chaos Engineering: Why the World Needs More Resilient Systems
C4Media546 views
APEX 5 Interactive Reports: Deep Dive and Upgrade Advice von Karen Cannell
APEX 5 Interactive Reports: Deep Dive and Upgrade AdviceAPEX 5 Interactive Reports: Deep Dive and Upgrade Advice
APEX 5 Interactive Reports: Deep Dive and Upgrade Advice
Karen Cannell5.4K views
Extending kubernetes with CustomResourceDefinitions von Stefan Schimanski
Extending kubernetes with CustomResourceDefinitionsExtending kubernetes with CustomResourceDefinitions
Extending kubernetes with CustomResourceDefinitions
Stefan Schimanski2.2K views
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat... von Daniel Bryant
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
Daniel Bryant145 views
Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t... von Philip Schwarz
Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...
Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t...
Philip Schwarz1.2K views
Kubernetes Failure Stories - KubeCon Europe Barcelona von Henning Jacobs
Kubernetes Failure Stories - KubeCon Europe BarcelonaKubernetes Failure Stories - KubeCon Europe Barcelona
Kubernetes Failure Stories - KubeCon Europe Barcelona
Henning Jacobs728 views

Destacado

Mockist vs Classicists TDD von
Mockist vs Classicists TDDMockist vs Classicists TDD
Mockist vs Classicists TDDDavid Völkel
1.6K views64 Folien
Bad test, good test von
Bad test, good testBad test, good test
Bad test, good testSeb Rose
6.7K views34 Folien
Integration Test Hell von
Integration Test HellIntegration Test Hell
Integration Test HellDavid Völkel
2.6K views34 Folien
Wie wird mein Code testbar? von
Wie wird mein Code testbar?Wie wird mein Code testbar?
Wie wird mein Code testbar?David Völkel
849 views45 Folien
Mockist vs. Classicists TDD von
Mockist vs. Classicists TDDMockist vs. Classicists TDD
Mockist vs. Classicists TDDDavid Völkel
3.2K views34 Folien
Unit vs. Integration Tests von
Unit vs. Integration TestsUnit vs. Integration Tests
Unit vs. Integration TestsDavid Völkel
2.2K views25 Folien

Destacado(10)

Mockist vs Classicists TDD von David Völkel
Mockist vs Classicists TDDMockist vs Classicists TDD
Mockist vs Classicists TDD
David Völkel1.6K views
Bad test, good test von Seb Rose
Bad test, good testBad test, good test
Bad test, good test
Seb Rose6.7K views
Wie wird mein Code testbar? von David Völkel
Wie wird mein Code testbar?Wie wird mein Code testbar?
Wie wird mein Code testbar?
David Völkel849 views
Mockist vs. Classicists TDD von David Völkel
Mockist vs. Classicists TDDMockist vs. Classicists TDD
Mockist vs. Classicists TDD
David Völkel3.2K views
Unit vs. Integration Tests von David Völkel
Unit vs. Integration TestsUnit vs. Integration Tests
Unit vs. Integration Tests
David Völkel2.2K views
Fake It Outside-In TDD Workshop @ Clean Code Days von David Völkel
Fake It Outside-In TDD Workshop @ Clean Code Days Fake It Outside-In TDD Workshop @ Clean Code Days
Fake It Outside-In TDD Workshop @ Clean Code Days
David Völkel670 views
Transformation Priority Premise @Softwerkskammer MUC von David Völkel
Transformation Priority Premise @Softwerkskammer MUCTransformation Priority Premise @Softwerkskammer MUC
Transformation Priority Premise @Softwerkskammer MUC
David Völkel1.3K views
Infrastructure as Code for Beginners von David Völkel
Infrastructure as Code for BeginnersInfrastructure as Code for Beginners
Infrastructure as Code for Beginners
David Völkel1.9K views

Similar a Fake It Outside-In TDD @XP2017

TDD Trade-Offs @Softwerkskammer Karlsruhe von
TDD Trade-Offs @Softwerkskammer KarlsruheTDD Trade-Offs @Softwerkskammer Karlsruhe
TDD Trade-Offs @Softwerkskammer KarlsruheDavid Völkel
582 views90 Folien
Wann soll ich mocken? von
Wann soll ich mocken?Wann soll ich mocken?
Wann soll ich mocken?David Völkel
748 views65 Folien
Jakość dostarczanego oprogramowania oparta o testy von
Jakość dostarczanego oprogramowania oparta o testyJakość dostarczanego oprogramowania oparta o testy
Jakość dostarczanego oprogramowania oparta o testyPaweł Tekliński
335 views61 Folien
C#7, 7.1, 7.2, 7.3 e C# 8 von
C#7, 7.1, 7.2, 7.3 e C# 8C#7, 7.1, 7.2, 7.3 e C# 8
C#7, 7.1, 7.2, 7.3 e C# 8Giovanni Bassi
760 views84 Folien
Como NÃO testar o seu projeto de Software. DevDay 2014 von
Como NÃO testar o seu projeto de Software. DevDay 2014Como NÃO testar o seu projeto de Software. DevDay 2014
Como NÃO testar o seu projeto de Software. DevDay 2014alexandre freire
1.7K views106 Folien
Why you should be using the shiny new C# 6.0 features now! von
Why you should be using the shiny new C# 6.0 features now!Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!Eric Phan
298 views45 Folien

Similar a Fake It Outside-In TDD @XP2017(20)

TDD Trade-Offs @Softwerkskammer Karlsruhe von David Völkel
TDD Trade-Offs @Softwerkskammer KarlsruheTDD Trade-Offs @Softwerkskammer Karlsruhe
TDD Trade-Offs @Softwerkskammer Karlsruhe
David Völkel582 views
Jakość dostarczanego oprogramowania oparta o testy von Paweł Tekliński
Jakość dostarczanego oprogramowania oparta o testyJakość dostarczanego oprogramowania oparta o testy
Jakość dostarczanego oprogramowania oparta o testy
Paweł Tekliński335 views
Como NÃO testar o seu projeto de Software. DevDay 2014 von alexandre freire
Como NÃO testar o seu projeto de Software. DevDay 2014Como NÃO testar o seu projeto de Software. DevDay 2014
Como NÃO testar o seu projeto de Software. DevDay 2014
alexandre freire1.7K views
Why you should be using the shiny new C# 6.0 features now! von Eric Phan
Why you should be using the shiny new C# 6.0 features now!Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!
Eric Phan298 views
Data Mining Open Ap Is von oscon2007
Data Mining Open Ap IsData Mining Open Ap Is
Data Mining Open Ap Is
oscon2007779 views
Serverless Finland Meetup 16.11.2016: Messenger Bot Workshop von Mikael Puittinen
Serverless Finland Meetup 16.11.2016: Messenger Bot WorkshopServerless Finland Meetup 16.11.2016: Messenger Bot Workshop
Serverless Finland Meetup 16.11.2016: Messenger Bot Workshop
Mikael Puittinen3.7K views
A Lifecycle Of Code Under Test by Robert Fornal von QA or the Highway
A Lifecycle Of Code Under Test by Robert FornalA Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert Fornal
QA or the Highway444 views
Fast REST APIs Development with MongoDB von MongoDB
Fast REST APIs Development with MongoDBFast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDB
MongoDB2.8K views
The Enterprise Architecture you always wanted: A Billion Transactions Per Mon... von Thoughtworks
The Enterprise Architecture you always wanted: A Billion Transactions Per Mon...The Enterprise Architecture you always wanted: A Billion Transactions Per Mon...
The Enterprise Architecture you always wanted: A Billion Transactions Per Mon...
Thoughtworks562 views
TypeScript and SharePoint Framework von Bob German
TypeScript and SharePoint FrameworkTypeScript and SharePoint Framework
TypeScript and SharePoint Framework
Bob German1.4K views
Pearson Plug and Play @ Over the Air von Dan Murphy
Pearson Plug and Play @ Over the AirPearson Plug and Play @ Over the Air
Pearson Plug and Play @ Over the Air
Dan Murphy1.1K views
DevSecCon London 2018: Open DevSecOps von DevSecCon
DevSecCon London 2018: Open DevSecOpsDevSecCon London 2018: Open DevSecOps
DevSecCon London 2018: Open DevSecOps
DevSecCon393 views
Awesome html with ujs, jQuery and coffeescript von Amir Barylko
Awesome html with ujs, jQuery and coffeescriptAwesome html with ujs, jQuery and coffeescript
Awesome html with ujs, jQuery and coffeescript
Amir Barylko1.1K views
Spare clive grinyer von lightningUX
Spare   clive grinyerSpare   clive grinyer
Spare clive grinyer
lightningUX270 views
Improve Your Salesforce Efficiency: Formulas for the Everyday Admin von Aggregage
Improve Your Salesforce Efficiency: Formulas for the Everyday AdminImprove Your Salesforce Efficiency: Formulas for the Everyday Admin
Improve Your Salesforce Efficiency: Formulas for the Everyday Admin
Aggregage38 views
Improve Your Salesforce Efficiency: Formulas for the Everyday Admin von Eve Lyons-Berg
Improve Your Salesforce Efficiency: Formulas for the Everyday AdminImprove Your Salesforce Efficiency: Formulas for the Everyday Admin
Improve Your Salesforce Efficiency: Formulas for the Everyday Admin
Eve Lyons-Berg154 views

Más de David Völkel

Die Kunst der kleinen Schritte - Softwerkskammer Lübeck von
Die Kunst der kleinen Schritte - Softwerkskammer LübeckDie Kunst der kleinen Schritte - Softwerkskammer Lübeck
Die Kunst der kleinen Schritte - Softwerkskammer LübeckDavid Völkel
330 views64 Folien
KPI Driven-Development in der Praxis - XP Days Germany von
KPI Driven-Development in der Praxis - XP Days GermanyKPI Driven-Development in der Praxis - XP Days Germany
KPI Driven-Development in der Praxis - XP Days GermanyDavid Völkel
384 views33 Folien
KPI-Driven-Development von
KPI-Driven-DevelopmentKPI-Driven-Development
KPI-Driven-DevelopmentDavid Völkel
187 views31 Folien
Global Day of Coderetreat Munich 2018 von
Global Day of Coderetreat Munich 2018Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018David Völkel
151 views74 Folien
Trade Off! von
Trade Off!Trade Off!
Trade Off!David Völkel
521 views22 Folien
Die Kunst der kleinen Schritte - XP Days Germany 2018 von
Die Kunst der kleinen Schritte - XP Days Germany 2018Die Kunst der kleinen Schritte - XP Days Germany 2018
Die Kunst der kleinen Schritte - XP Days Germany 2018David Völkel
289 views52 Folien

Más de David Völkel(11)

Die Kunst der kleinen Schritte - Softwerkskammer Lübeck von David Völkel
Die Kunst der kleinen Schritte - Softwerkskammer LübeckDie Kunst der kleinen Schritte - Softwerkskammer Lübeck
Die Kunst der kleinen Schritte - Softwerkskammer Lübeck
David Völkel330 views
KPI Driven-Development in der Praxis - XP Days Germany von David Völkel
KPI Driven-Development in der Praxis - XP Days GermanyKPI Driven-Development in der Praxis - XP Days Germany
KPI Driven-Development in der Praxis - XP Days Germany
David Völkel384 views
Global Day of Coderetreat Munich 2018 von David Völkel
Global Day of Coderetreat Munich 2018Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018
David Völkel151 views
Die Kunst der kleinen Schritte - XP Days Germany 2018 von David Völkel
Die Kunst der kleinen Schritte - XP Days Germany 2018Die Kunst der kleinen Schritte - XP Days Germany 2018
Die Kunst der kleinen Schritte - XP Days Germany 2018
David Völkel289 views
Global Day of Coderetreat Munich 2017 von David Völkel
Global Day of Coderetreat Munich 2017Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017
David Völkel423 views
Baby Steps TDD Approaches von David Völkel
Baby Steps TDD ApproachesBaby Steps TDD Approaches
Baby Steps TDD Approaches
David Völkel3.3K views
Clean Test Code (Clean Code Days) von David Völkel
Clean Test Code (Clean Code Days)Clean Test Code (Clean Code Days)
Clean Test Code (Clean Code Days)
David Völkel2K views
Mockist vs. Classicists TDD von David Völkel
Mockist vs. Classicists TDDMockist vs. Classicists TDD
Mockist vs. Classicists TDD
David Völkel2.3K views

Último

The Path to DevOps von
The Path to DevOpsThe Path to DevOps
The Path to DevOpsJohn Valentino
5 views6 Folien
Electronic AWB - Electronic Air Waybill von
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill Freightoscope
5 views1 Folie
Ports-and-Adapters Architecture for Embedded HMI von
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIBurkhard Stubert
33 views19 Folien
Quality Assurance von
Quality Assurance Quality Assurance
Quality Assurance interworksoftware2
5 views6 Folien
predicting-m3-devopsconMunich-2023.pptx von
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptxTier1 app
8 views24 Folien
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... von
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...Stefan Wolpers
42 views38 Folien

Último(20)

Electronic AWB - Electronic Air Waybill von Freightoscope
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill
Freightoscope 5 views
Ports-and-Adapters Architecture for Embedded HMI von Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert33 views
predicting-m3-devopsconMunich-2023.pptx von Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app8 views
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... von Stefan Wolpers
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
Stefan Wolpers42 views
Dapr Unleashed: Accelerating Microservice Development von Miroslav Janeski
Dapr Unleashed: Accelerating Microservice DevelopmentDapr Unleashed: Accelerating Microservice Development
Dapr Unleashed: Accelerating Microservice Development
Miroslav Janeski15 views
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... von TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 views
Generic or specific? Making sensible software design decisions von Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
Bootstrapping vs Venture Capital.pptx von Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic15 views
Top-5-production-devconMunich-2023-v2.pptx von Tier1 app
Top-5-production-devconMunich-2023-v2.pptxTop-5-production-devconMunich-2023-v2.pptx
Top-5-production-devconMunich-2023-v2.pptx
Tier1 app8 views
JioEngage_Presentation.pptx von admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254558 views
tecnologia18.docx von nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67025 views
Automated Testing of Microsoft Power BI Reports von RTTS
Automated Testing of Microsoft Power BI ReportsAutomated Testing of Microsoft Power BI Reports
Automated Testing of Microsoft Power BI Reports
RTTS10 views

Fake It Outside-In TDD @XP2017

  • 1. FAKE IT OUTSIDE-IN TDD David Völkel 24th May @ XP 2017
  • 3. INFLUENCES 2003 Kent Beck’s "Fake It" Pattern 2009 #GOOS’s "Outside-In" Design 2013 Emily Bache 
 "Outside-In development with Double Loop TDD" 2014 Justin Searls "The Failures of 'Intro to TDD'" COMBINATION 2015 Dimitry Polivaev Outside-In with faked Data 2016 SoCraTes DE Outside-In Fake It Session 2017 Refinement
  • 4. INFLUENCES 2003 Kent Beck’s "Fake It" Pattern 2009 #GOOS’s "Outside-In" Design 2013 Emily Bache 
 "Outside-In development with Double Loop TDD" 2014 Justin Searls "The Failures of 'Intro to TDD'" COMBINATION 2015 Dimitry Polivaev Outside-In with faked Data 2016 SoCraTes DE Outside-In Fake It Session 2017 Refinement
  • 5. INFLUENCES 2003 Kent Beck’s "Fake It" Pattern 2009 #GOOS’s "Outside-In" Design COMBINATION FAKE IT OUTSIDE-IN TDD
  • 6. INFLUENCES 2003 Kent Beck’s "Fake It" Pattern 2009 #GOOS’s "Outside-In" Design 2013 Emily Bache 
 "Outside-In development with Double Loop TDD" 2014 Justin Searls "The Failures of 'Intro to TDD'" COMBINATION 2016 SoCraTes DE Outside-In Fake It Session
  • 7. INFLUENCES 2003 Kent Beck’s "Fake It" Pattern 2009 #GOOS’s "Outside-In" Design 2013 Emily Bache 
 "Outside-In development with Double Loop TDD" 2014 Justin Searls "The Failures of 'Intro to TDD'" COMBINATION 2016 SoCraTes DE Outside-In Fake It Session 2017 Refinement / Work in Progress
  • 8. INFLUENCES 2003 Kent Beck’s "Fake It" Pattern 2009 #GOOS’s "Outside-In" Design 2013 Emily Bache 
 "Outside-In development with Double Loop TDD" COMBINATION 2016 SoCraTes DE Outside-In Fake It Session 2017 Refinement / Work in Progress
  • 9. INFLUENCES 2003 Kent Beck’s "Fake It" Pattern 2009 #GOOS’s "Outside-In" Design 2013 Emily Bache 
 "Outside-In development with Double Loop TDD" 2014 Justin Searls "The Failures of 'Intro to TDD'" COMBINATION 2016 SoCraTes DE Outside-In Fake It Session 2017 Refinement / Work in Progress
  • 10. INFLUENCES 2003 Kent Beck’s "Fake It" Pattern 2009 #GOOS’s "Outside-In" Design 2013 Emily Bache 
 "Outside-In development with Double Loop TDD" 2014 Justin Searls "The Failures of 'Intro to TDD'" 2017 Llewelyn Falco „Extreme: Fake it Till you Make It“ COMBINATION 2016 SoCraTes DE Outside-In Fake It Session 2017 Refinement / Work in Progress
  • 11. AGENDA Theory Building Blocks Fake It Outside-In Practice Mob Programming Session Reflect Trade-Offs Discussion
  • 13. INTEGRATION OPERATION SEGREGATION PRINCIPLE *"Integration Operation Segregation Principle", Ralf Westphal "Die kniffligen Fälle beim Testen - Sichtbarkeit", Stefan Lieser *
  • 14. INTEGRATION OPERATION SEGREGATION PRINCIPLE public void sendDiscountMailingTo(String email) { Customer customer = customerDB.findCustomerBy(email); Account account = customer.account(); String discount = account == FREE ? "no" : account == BASE ? "a 10%" : account == PREMIUM ? "a 25%" : "-ERROR-"; String content = "Hello " + customer.getName() + ",nn" + "This week you get " + discount + " discount " + "on all our products.nn" + "Best Regards,n" + "ACME Customer Service"; mailService.sendMail(email, content); }
  • 15. OPERATION public void sendDiscountMailingTo(String email) { Customer customer = customerDB.findCustomerBy(email); Account account = customer.account(); String discount = account == FREE ? "no" : account == BASE ? "a 10%" : account == PREMIUM ? "a 25%" : "-ERROR-"; String content = "Hello " + customer.getName() + ",nn" + "This week you get " + discount + " discount " + "on all our products.nn" + "Best Regards,n" + "ACME Customer Service"; mailService.sendMail(email, content); } INTEGRATION OPERATION SEGREGATION PRINCIPLE
  • 16. INTEGRATION INTEGRATION OPERATION public void sendDiscountMailingTo(String email) { Customer customer = customerDB.findCustomerBy(email); Account account = customer.account(); String discount = account == FREE ? "no" : account == BASE ? "a 10%" : account == PREMIUM ? "a 25%" : "-ERROR-"; String content = "Hello " + customer.getName() + ",nn" + "This week you get " + discount + " discount " + "on all our products.nn" + "Best Regards,n" + "ACME Customer Service"; mailService.sendMail(email, content); } INTEGRATION OPERATION SEGREGATION PRINCIPLE
  • 17. INTEGRATION INTEGRATION OPERATION public void sendDiscountMailingTo(String email) { Customer customer = customerDB.findCustomerBy(email); Account account = customer.account(); String discount = account == FREE ? "no" : account == BASE ? "a 10%" : account == PREMIUM ? "a 25%" : "-ERROR-"; String content = "Hello " + customer.getName() + ",nn" + "This week you get " + discount + " discount " + "on all our products.nn" + "Best Regards,n" + "ACME Customer Service"; mailService.sendMail(email, content); } INTEGRATION OPERATION SEGREGATION PRINCIPLE
  • 18. OPERATION INTEGRATION public void sendDiscountMailingTo(String email) { Customer customer = customerDB.findCustomerBy(email); String content = renderMessage(customer, customer.account()); mailService.sendMail(email, content); } private String renderMessage(Customer customer, Account account) { String discount = account == FREE ? "no" : account == BASE ? "a 10%" : account == PREMIUM ? "a 25%" : "-ERROR-"; return "Hello " + customer.getName() + ",nn" + "This week you get " + discount + " discount " + "on all our products.nn" + "Best Regards,n" + "ACME Customer Service"; } INTEGRATION OPERATION SEGREGATION PRINCIPLE
  • 19. public void sendDiscountMailingTo(String email) { Customer customer = customerDB.findCustomerBy(email); String content = renderMessage(customer, customer.account()); mailService.sendMail(email, content); } private String renderMessage(Customer customer, Account account) { String discount = account == FREE ? "no" : account == BASE ? "a 10%" : account == PREMIUM ? "a 25%" : "-ERROR-"; return "Hello " + customer.getName() + ",nn" + "This week you get " + discount + " discount " + "on all our products.nn" + "Best Regards,n" + "ACME Customer Service"; } TESTS?
  • 20. OPERATION public void sendDiscountMailingTo(String email) { Customer customer = customerDB.findCustomerBy(email); String content = renderMessage(customer, customer.account()); mailService.sendMail(email, content); } private String renderMessage(Customer customer, Account account) { String discount = account == FREE ? "no" : account == BASE ? "a 10%" : account == PREMIUM ? "a 25%" : "-ERROR-"; return "Hello " + customer.getName() + ",nn" + "This week you get " + discount + " discount " + "on all our products.nn" + "Best Regards,n" + "ACME Customer Service"; } TESTS? N UNITTESTS
  • 21. INTEGRATION OPERATION public void sendDiscountMailingTo(String email) { Customer customer = customerDB.findCustomerBy(email); String content = renderMessage(customer, customer.account()); mailService.sendMail(email, content); } private String renderMessage(Customer customer, Account account) { String discount = account == FREE ? "no" : account == BASE ? "a 10%" : account == PREMIUM ? "a 25%" : "-ERROR-"; return "Hello " + customer.getName() + ",nn" + "This week you get " + discount + " discount " + "on all our products.nn" + "Best Regards,n" + "ACME Customer Service"; } TESTS?1 INTEGRATION TEST N UNITTESTS
  • 22. GREEN BAR PATTERNS* Obvious Implementation Fake it (until you make it) Triangulation * Kent Beck in "TDD by Example"
  • 23. GREEN BAR PATTERNS Obvious Implementation Fake it Triangulation Trade-Off Complexity
  • 25. SWEET SPOT Logic GREEN BAR PATTERNS Obvious Implementation Fake it Triangulation
  • 26. SWEET SPOT Structure Logic GREEN BAR PATTERNS Obvious Implementation Fake it Triangulation
  • 27. SWEET SPOT Trivial Structure Logic GREEN BAR PATTERNS Obvious Implementation Fake it Triangulation
  • 29. PREPARATORY REFACTORINGS* *"An example of preparatory refactoring", Martin Fowler
  • 31. LIMIT YOUR TIME IN RED "Green Phase" Implementation Run Test Implementation Run TestPreparatory Refactoring
  • 40. Acceptance Test Drive Structure through Refactoring OUTSIDE-IN & FAKE IT
  • 41. OUTSIDE-IN & FAKE IT Acceptance Test Unit Test Fill logic with triangulation
  • 42. OUTSIDE-IN & FAKE IT Acceptance Test Unit Test
  • 43. OUTSIDE-IN & FAKE IT INTEGRATION Fake It Triangulation OPERATION Start with • comprehensive 
 Acceptance Test • faked result Drive structure by refactoring Drive logic by unit tests
  • 44. OUTSIDE-IN & FAKE IT INTEGRATION Fake It Triangulation OPERATION Start with • comprehensive 
 Acceptance Test • faked result Drive structure by refactoring Drive logic by unit tests
  • 49. CODING SESSION KATA Continue Diamond Kata https://github.com/davidvoelkel/diamond-kata CONSTRAINTS Drive structure by refactoring Drive conditionals by triangulation
  • 50. TRADE-OFFS FAKE IT VS OUTSIDE-IN & MOCKS TRIANGULATION
  • 51. CONDITIONAL INTERACTIONS Mocking when IOSP not possible public String signup(String username) throws Exception { if(userDB.findUserBy(username) == null) { userDB.createUser(new User(username)); return "Welcome " + username; } else { return "Username ' " + username + "' " + "already taken, please choose another"; } }
  • 52. COUPLING OUTSIDE-IN Mocking Fake It Decoupling Refactorability
  • 53. DATA GUIDES STRUCTURE Triangulation Fake It Structure Cumbersome Data guides well
  • 54. # BRANCHES Triangulation Fake It # N 1 More confidence More effort
  • 55. # BRANCHES Triangulation Fake It # N 1 Fake data easy to forget Omitting cases is tempting
  • 56. TIME IN GREEN Triangulation Prep Refactoring Triangulation Fake It
  • 59. IMAGES Most are Public Domain except theses Creative Commons with attributions: "Unstruttalbrücke" by Störfix From State Library of Queensland