SlideShare a Scribd company logo
Outside-in
Test Driven Development
(London School TDD)
Software Quality Days 2019
Peter Kofler, ‘Code Cop’
@codecopkofler
www.code-cop.org
Copyright Peter Kofler, licensed under CC-BY.
Peter Kofler
• Ph.D. (Appl. Math.)
• Professional Software
Developer for 20 years
• “fanatic about code quality”
• Independent Code Quality Coach
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
I help development teams with
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
●
Professionalism
●
Quality and
Productivity
●
Continuous
Improvement
Mentoring
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
●
Pair Programming
●
Programming
Workshops
●
Deliberate
Practice, e.g.
Coding Dojos
Developing Quality
Software Developers
Agenda
●
Recap Classic TDD
●
Introduction
Outside-in TDD
●
Coding Exercise
●
“Bank OCR“
●
Retrospective
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Test Driven
Development
Your experience with TDD?
●
When and how are you applying TDD?
●
What are you
using every day?
●
Any problems?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Test-Driven Development is
●
a programming practice in which all
production code is written in response
to a failing test.
●
a practice for designing and coding
software applications.
●
not a replacement for testing.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Nathaniel Pryce, http://www.doc.ic.ac.uk/~np2/teaching/
Red Green Refactor
TDD Cycle
●
add a test
●
run all tests and see if the new one fails
●
write little code
●
run all tests and see them succeed
●
refactor code mercilessly
●
repeat
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Uncle Bob’s 3 Laws of TDD
●
You are not allowed to write any ...
●
… production code
unless to make a failing test pass.
●
… more of a unit test
than is sufficient to fail the test.
●
… more production code
than is sufficient to pass the test.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
How do we design using TDD?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
e.g. Scanning Numbers
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
●
We need to scan
documents.
●
Documents
contain numbers.
●
Numbers consist
of digits.
“Chicago” School TDD
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanning Numbers #1
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
●
Classic TDD aka
“Chicago” or
“Detroit School”
●
Inside-out =
working from
„bottom“ up
Scanning Numbers #2
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
Scanning Numbers #3
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
Test
Scanning Numbers #4
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
Test
Test
Summary of Classic TDD

Working from „bottom“ up

Collaborators usually not mocked
(just used)

State-based tests

Emergent design during refactoring

Avoids over-engineering
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Franziska Sauerwein, http://slides.com/franziskasauerwein/outside#/
“London” School TDD
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanning Numbers #1
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
●
Mockist TDD aka
“London School”
●
Outside-in =
following the
user interaction
Outside-In
●
build the system from the "outside-in"
●
helps identify top level function/class,
entry point to the desired functionality,
●
e.g. widget in GUI, link on a
web page, or command line flag
●
following the user interaction
through all the parts of the system
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanning Numbers #2
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Test
Mock
Mock
Scanning Numbers #3
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Test
Mock
Test
Mock
Mock
Scanning Numbers #4
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
Test
Test
Summary of Outside-In TDD

Working from „outside“ in.

Assume collaborators and mock them.

Verify behaviour, not state.

Design in Red stage.

Follow Tell-Don't-Ask principle.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Franziska Sauerwein, http://slides.com/franziskasauerwein/outside#/
What is a
“Mock”?
Five Types of Test Doubles
●
Dummy (Object)
●
Fake (Object)
●
Stub
●
Partial Stub
●
Spy
●
Mock
●
Partial Mock
●
Test-Specific Subclass
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
How to “Mock” an Object
●
by hand
●
implement its interface (Eclipse Ctrl-1)
●
subclass it (beware complex constructors)
●
with java.lang.reflect.Proxy
●
since Java 1.3
●
only for interfaces
●
nasty for more than 1 method
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Mocking Frameworks
●
e.g. Mockito, moq, Sinon.JS, ...
●
mock interfaces (Proxy)
●
mock non final classes (cglib)
import static org.easymock.EasyMock.*;
SomeInt mock = createMock(SomeInt.class);
expect(mock.someMethod("param")).andReturn(42);
replay(mock);
// run the test which calls someMethod once
verify(mock);
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Double Loop TDD
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Nathaniel Pryce, http://www.doc.ic.ac.uk/~np2/teaching/
Red Green Refactor
Write a failing end-to-end test
Nathaniel Pryce, http://www.doc.ic.ac.uk/~np2/teaching/
Double Loop TDD
Design Process
●
create an Acceptance/Guiding Test (red)
●
start with top level interaction (from UI)
●
discover/design needed collaborators
●
stub/mock these dependencies
●
implement using TDD
●
run Guiding Test to see where to go next
●
while Guiding Test is still red
●
move down to previously mocked collaborator
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Emily Bache, http://coding-is-like-cooking.info/2013/04/outside-in-development-with-double-loop-tdd/
Scanner
NumberScanner
DigitScanner
Scanning Numbers #1
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Guiding Test
Scanner
NumberScanner
DigitScanner
Scanning Numbers #2
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Test
Mock
Guiding Test
Scanner
NumberScanner
DigitScanner
Scanning Numbers #3
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Test
Mock
Guiding Test
Mock
Scanner
NumberScanner
DigitScanner
Scanning Numbers #4
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Mock
Test
Guiding Test
Test
Mock
Scanner
NumberScanner
DigitScanner
Scanning Numbers #5
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Mock
Test
Guiding Test
Test
Mock
Mock
Scanner
NumberScanner
DigitScanner
Scanning Numbers #6
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
Guiding Test
Test
Test
Mock
Mock
Scanner
NumberScanner
DigitScanner
Scanning Numbers #7
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
Guiding Test
Test
Test
Try it yourself
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Coding Dojo Mindset
●
Safe place outside
work
●
We are here to learn
●
Need to slow down
●
Focus on doing it right
●
Collaborative Game
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Assignment
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Bank OCR
●
You work for a bank, which has a machine to assist in reading
letters. The machine scans the paper documents, and produces
a file with a number of entries which each look like this:
····_··_·····_··_··_··_··_·
··|·_|·_||_||_·|_···||_||_|
··||_··_|··|·_||_|··||_|·_|
●
Each entry is 4 lines long, each line has 27 characters. The first
3 lines contain an account number written using pipes and
underscores, and the fourth line is blank. Each account
number should have 9 digits, all of which should be in the
range 1-9.
●
Write a program that can take this file and parse it into actual
account numbers.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Prepare
● Find a pair.
● Agree on a programming language.
● Get the project from
https://bitbucket.org/pkofler/bankocr-kata-setup
● See GuidingTest (failing test)
● Guiding Test is the starting point.
● Work through outer API, outside-in.
● Implement Bank OCR.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Recommended: A Test List
●
Use first ten minutes to
create list of acceptance
test cases (on paper)
●
Start each TDD cycle with
at least three test cases
before beginning to code
(paper or text file)
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Apply: Outside-In TDD
●
build the system from the "outside-in",
following the user interaction
through all the parts of the system
●
create a Guiding Test
●
start with top level interactions
●
mock dependencies
●
implement using TDD until all tests green
●
move inside previously mocked collaborator
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Don't Focus on
Getting it Done.
F0cus on Doing
It Perfectly.
Practice
Closing Circle
●
What did you learn today?
●
What surprised you today?
●
What will you do
differently in the
future?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Study!
●
TDD is important.
●
You need to study it.
●
Good books:
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Peter Kofler
@codecopkofler
www.code-cop.org
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
CC Images
●
London https://www.flickr.com/photos/damski/8019978119
●
Bruce http://www.flickr.com/photos/sherpas428/4350620602/
●
pairing http://www.flickr.com/photos/dav/94735395/
●
agenda http://www.flickr.com/photos/24293932@N00/2752221871/
●
wants you http://www.flickr.com/photos/shutter/105497713/
●
drawing https://www.flickr.com/photos/msk13/4108489367
●
Chicago https://www.flickr.com/photos/pedrosz/34886261555/
●
mocks http://www.flickr.com/photos/sneddon/2413980712/
●
loops https://www.flickr.com/photos/fitzharris/7592626086/
●
hands https://www.flickr.com/photos/ninahiironniemi/497993647/
●
dojo http://www.flickr.com/photos/49715404@N00/3267627038/
●
bank https://www.flickr.com/photos/bigmacsc99/4325336251
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

More Related Content

What's hot

Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
Amal Mohan N
 
Mockist vs. Classicists TDD
Mockist vs. Classicists TDDMockist vs. Classicists TDD
Mockist vs. Classicists TDD
David Völkel
 
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Steve Pember
 
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Sam Brannen
 
Modular Monoliths with Nx
Modular Monoliths with NxModular Monoliths with Nx
Modular Monoliths with Nx
stefanhaasprivat
 
Software Engineering Culture - Improve Code Quality
Software Engineering Culture - Improve Code QualitySoftware Engineering Culture - Improve Code Quality
Software Engineering Culture - Improve Code Quality
Dmytro Patserkovskyi
 
Asynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureAsynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFuture
José Paumard
 
Flutter A year of creativity!
Flutter A year of creativity!Flutter A year of creativity!
Flutter A year of creativity!
Ahmed Abu Eldahab
 
Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...
Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...
Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...
Sri Ambati
 
Mikrotik metarouter
Mikrotik metarouterMikrotik metarouter
Mikrotik metarouter
Achmad Mardiansyah
 
A Glance At The Java Performance Toolbox-TIA.pdf
 A Glance At The Java Performance Toolbox-TIA.pdf A Glance At The Java Performance Toolbox-TIA.pdf
A Glance At The Java Performance Toolbox-TIA.pdf
Ana-Maria Mihalceanu
 
Docker Fundamental
Docker FundamentalDocker Fundamental
Docker Fundamental
Chotibul Umam
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
Aaron Schlesinger
 
Tdd and bdd
Tdd and bddTdd and bdd
Tdd and bdd
MohamedSubhiBouchi
 
Embracing DevOps through database migrations with Flyway
Embracing DevOps through database migrations with FlywayEmbracing DevOps through database migrations with Flyway
Embracing DevOps through database migrations with Flyway
Red Gate Software
 
Codemotion Madrid 2023 - Testcontainers y Spring Boot
Codemotion Madrid 2023 - Testcontainers y Spring BootCodemotion Madrid 2023 - Testcontainers y Spring Boot
Codemotion Madrid 2023 - Testcontainers y Spring Boot
Iván López Martín
 
The Art of Unit Testing - Towards a Testable Design
The Art of Unit Testing - Towards a Testable DesignThe Art of Unit Testing - Towards a Testable Design
The Art of Unit Testing - Towards a Testable Design
Victor Rentea
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Md. Enamul Haque Chowdhury
 
Introduction to Docker Compose | Docker Intermediate Workshop
Introduction to Docker Compose | Docker Intermediate WorkshopIntroduction to Docker Compose | Docker Intermediate Workshop
Introduction to Docker Compose | Docker Intermediate Workshop
Ajeet Singh Raina
 

What's hot (20)

Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
Mockist vs. Classicists TDD
Mockist vs. Classicists TDDMockist vs. Classicists TDD
Mockist vs. Classicists TDD
 
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
 
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
 
Modular Monoliths with Nx
Modular Monoliths with NxModular Monoliths with Nx
Modular Monoliths with Nx
 
Software Engineering Culture - Improve Code Quality
Software Engineering Culture - Improve Code QualitySoftware Engineering Culture - Improve Code Quality
Software Engineering Culture - Improve Code Quality
 
Asynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureAsynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFuture
 
Flutter A year of creativity!
Flutter A year of creativity!Flutter A year of creativity!
Flutter A year of creativity!
 
Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...
Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...
Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...
 
Mikrotik metarouter
Mikrotik metarouterMikrotik metarouter
Mikrotik metarouter
 
A Glance At The Java Performance Toolbox-TIA.pdf
 A Glance At The Java Performance Toolbox-TIA.pdf A Glance At The Java Performance Toolbox-TIA.pdf
A Glance At The Java Performance Toolbox-TIA.pdf
 
Docker Fundamental
Docker FundamentalDocker Fundamental
Docker Fundamental
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
 
Tdd and bdd
Tdd and bddTdd and bdd
Tdd and bdd
 
Embracing DevOps through database migrations with Flyway
Embracing DevOps through database migrations with FlywayEmbracing DevOps through database migrations with Flyway
Embracing DevOps through database migrations with Flyway
 
Codemotion Madrid 2023 - Testcontainers y Spring Boot
Codemotion Madrid 2023 - Testcontainers y Spring BootCodemotion Madrid 2023 - Testcontainers y Spring Boot
Codemotion Madrid 2023 - Testcontainers y Spring Boot
 
The Art of Unit Testing - Towards a Testable Design
The Art of Unit Testing - Towards a Testable DesignThe Art of Unit Testing - Towards a Testable Design
The Art of Unit Testing - Towards a Testable Design
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Introduction to Docker Compose | Docker Intermediate Workshop
Introduction to Docker Compose | Docker Intermediate WorkshopIntroduction to Docker Compose | Docker Intermediate Workshop
Introduction to Docker Compose | Docker Intermediate Workshop
 

Similar to Outside-in Test Driven Development - the London School of TDD

Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)
Peter Kofler
 
Code Quality Assurance v4 (2013)
Code Quality Assurance v4 (2013)Code Quality Assurance v4 (2013)
Code Quality Assurance v4 (2013)Peter Kofler
 
Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)
Peter Kofler
 
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Peter Kofler
 
Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)
Peter Kofler
 
Prime Factors Code Kata - Practicing TDD (2014)
Prime Factors Code Kata - Practicing TDD (2014)Prime Factors Code Kata - Practicing TDD (2014)
Prime Factors Code Kata - Practicing TDD (2014)
Peter Kofler
 
Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)
Peter Kofler
 
Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)
Peter Kofler
 
TDD as if You Meant It (2013)
TDD as if You Meant It (2013)TDD as if You Meant It (2013)
TDD as if You Meant It (2013)
Peter Kofler
 
JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)
Peter Kofler
 
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Peter Kofler
 
Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)
Peter Kofler
 
Extract Method Refactoring Workshop (2016)
Extract Method Refactoring Workshop (2016)Extract Method Refactoring Workshop (2016)
Extract Method Refactoring Workshop (2016)
Peter Kofler
 
Coding Dojo: Roman Numerals (2014)
Coding Dojo: Roman Numerals (2014)Coding Dojo: Roman Numerals (2014)
Coding Dojo: Roman Numerals (2014)Peter Kofler
 
Coding Dojo: String Calculator (2013)
Coding Dojo: String Calculator (2013)Coding Dojo: String Calculator (2013)
Coding Dojo: String Calculator (2013)Peter Kofler
 
Coding Dojo: Adding Tests to Legacy Code (2014)
Coding Dojo: Adding Tests to Legacy Code (2014)Coding Dojo: Adding Tests to Legacy Code (2014)
Coding Dojo: Adding Tests to Legacy Code (2014)Peter Kofler
 
Refactoring the Tennis Kata v2 (2016)
Refactoring the Tennis Kata v2 (2016)Refactoring the Tennis Kata v2 (2016)
Refactoring the Tennis Kata v2 (2016)
Peter Kofler
 
Pair Programming (2015)
Pair Programming (2015)Pair Programming (2015)
Pair Programming (2015)
Peter Kofler
 
Coding Dojo: Data Munging (2016)
Coding Dojo: Data Munging (2016)Coding Dojo: Data Munging (2016)
Coding Dojo: Data Munging (2016)
Peter Kofler
 
Coding Dojo: Asynchronous Clock-In (2016)
Coding Dojo: Asynchronous Clock-In (2016)Coding Dojo: Asynchronous Clock-In (2016)
Coding Dojo: Asynchronous Clock-In (2016)
Peter Kofler
 

Similar to Outside-in Test Driven Development - the London School of TDD (20)

Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)
 
Code Quality Assurance v4 (2013)
Code Quality Assurance v4 (2013)Code Quality Assurance v4 (2013)
Code Quality Assurance v4 (2013)
 
Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)
 
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
 
Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)
 
Prime Factors Code Kata - Practicing TDD (2014)
Prime Factors Code Kata - Practicing TDD (2014)Prime Factors Code Kata - Practicing TDD (2014)
Prime Factors Code Kata - Practicing TDD (2014)
 
Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)
 
Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)
 
TDD as if You Meant It (2013)
TDD as if You Meant It (2013)TDD as if You Meant It (2013)
TDD as if You Meant It (2013)
 
JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)
 
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
 
Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)
 
Extract Method Refactoring Workshop (2016)
Extract Method Refactoring Workshop (2016)Extract Method Refactoring Workshop (2016)
Extract Method Refactoring Workshop (2016)
 
Coding Dojo: Roman Numerals (2014)
Coding Dojo: Roman Numerals (2014)Coding Dojo: Roman Numerals (2014)
Coding Dojo: Roman Numerals (2014)
 
Coding Dojo: String Calculator (2013)
Coding Dojo: String Calculator (2013)Coding Dojo: String Calculator (2013)
Coding Dojo: String Calculator (2013)
 
Coding Dojo: Adding Tests to Legacy Code (2014)
Coding Dojo: Adding Tests to Legacy Code (2014)Coding Dojo: Adding Tests to Legacy Code (2014)
Coding Dojo: Adding Tests to Legacy Code (2014)
 
Refactoring the Tennis Kata v2 (2016)
Refactoring the Tennis Kata v2 (2016)Refactoring the Tennis Kata v2 (2016)
Refactoring the Tennis Kata v2 (2016)
 
Pair Programming (2015)
Pair Programming (2015)Pair Programming (2015)
Pair Programming (2015)
 
Coding Dojo: Data Munging (2016)
Coding Dojo: Data Munging (2016)Coding Dojo: Data Munging (2016)
Coding Dojo: Data Munging (2016)
 
Coding Dojo: Asynchronous Clock-In (2016)
Coding Dojo: Asynchronous Clock-In (2016)Coding Dojo: Asynchronous Clock-In (2016)
Coding Dojo: Asynchronous Clock-In (2016)
 

More from Peter Kofler

Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)
Peter Kofler
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
Peter Kofler
 
Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)
Peter Kofler
 
Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)
Peter Kofler
 
Designing Test Cases for the Gilded Rose Kata v3 (2016)
Designing Test Cases for the Gilded Rose Kata v3 (2016)Designing Test Cases for the Gilded Rose Kata v3 (2016)
Designing Test Cases for the Gilded Rose Kata v3 (2016)
Peter Kofler
 
Mob Programming (2016)
Mob Programming (2016)Mob Programming (2016)
Mob Programming (2016)
Peter Kofler
 
Code Retreat Venice (2016)
Code Retreat Venice (2016)Code Retreat Venice (2016)
Code Retreat Venice (2016)
Peter Kofler
 
Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)
Peter Kofler
 
GDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran CanariaGDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran Canaria
Peter Kofler
 
Designing Test Cases for the Gilded Rose Kata v2 (2015)
Designing Test Cases for the Gilded Rose Kata v2 (2015)Designing Test Cases for the Gilded Rose Kata v2 (2015)
Designing Test Cases for the Gilded Rose Kata v2 (2015)
Peter Kofler
 
Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Peter Kofler
 
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Peter Kofler
 
Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Peter Kofler
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Peter Kofler
 
Coding Dojo: Bank OCR (2014)
Coding Dojo: Bank OCR (2014)Coding Dojo: Bank OCR (2014)
Coding Dojo: Bank OCR (2014)Peter Kofler
 

More from Peter Kofler (15)

Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)
 
Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)
 
Designing Test Cases for the Gilded Rose Kata v3 (2016)
Designing Test Cases for the Gilded Rose Kata v3 (2016)Designing Test Cases for the Gilded Rose Kata v3 (2016)
Designing Test Cases for the Gilded Rose Kata v3 (2016)
 
Mob Programming (2016)
Mob Programming (2016)Mob Programming (2016)
Mob Programming (2016)
 
Code Retreat Venice (2016)
Code Retreat Venice (2016)Code Retreat Venice (2016)
Code Retreat Venice (2016)
 
Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)
 
GDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran CanariaGDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran Canaria
 
Designing Test Cases for the Gilded Rose Kata v2 (2015)
Designing Test Cases for the Gilded Rose Kata v2 (2015)Designing Test Cases for the Gilded Rose Kata v2 (2015)
Designing Test Cases for the Gilded Rose Kata v2 (2015)
 
Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)
 
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
 
Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)
 
Coding Dojo: Bank OCR (2014)
Coding Dojo: Bank OCR (2014)Coding Dojo: Bank OCR (2014)
Coding Dojo: Bank OCR (2014)
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 

Outside-in Test Driven Development - the London School of TDD

  • 1. Outside-in Test Driven Development (London School TDD) Software Quality Days 2019 Peter Kofler, ‘Code Cop’ @codecopkofler www.code-cop.org Copyright Peter Kofler, licensed under CC-BY.
  • 2. Peter Kofler • Ph.D. (Appl. Math.) • Professional Software Developer for 20 years • “fanatic about code quality” • Independent Code Quality Coach PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 3. I help development teams with PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY ● Professionalism ● Quality and Productivity ● Continuous Improvement
  • 4. Mentoring PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY ● Pair Programming ● Programming Workshops ● Deliberate Practice, e.g. Coding Dojos
  • 6. Agenda ● Recap Classic TDD ● Introduction Outside-in TDD ● Coding Exercise ● “Bank OCR“ ● Retrospective PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 8. Your experience with TDD? ● When and how are you applying TDD? ● What are you using every day? ● Any problems? PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 9. Test-Driven Development is ● a programming practice in which all production code is written in response to a failing test. ● a practice for designing and coding software applications. ● not a replacement for testing. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 11. TDD Cycle ● add a test ● run all tests and see if the new one fails ● write little code ● run all tests and see them succeed ● refactor code mercilessly ● repeat PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 12. Uncle Bob’s 3 Laws of TDD ● You are not allowed to write any ... ● … production code unless to make a failing test pass. ● … more of a unit test than is sufficient to fail the test. ● … more production code than is sufficient to pass the test. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
  • 13. How do we design using TDD? PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 14. e.g. Scanning Numbers PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner ● We need to scan documents. ● Documents contain numbers. ● Numbers consist of digits.
  • 15. “Chicago” School TDD PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 16. Scanning Numbers #1 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner ● Classic TDD aka “Chicago” or “Detroit School” ● Inside-out = working from „bottom“ up
  • 17. Scanning Numbers #2 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScannerTest
  • 18. Scanning Numbers #3 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScannerTest Test
  • 19. Scanning Numbers #4 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScannerTest Test Test
  • 20. Summary of Classic TDD  Working from „bottom“ up  Collaborators usually not mocked (just used)  State-based tests  Emergent design during refactoring  Avoids over-engineering PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Franziska Sauerwein, http://slides.com/franziskasauerwein/outside#/
  • 21. “London” School TDD PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 22. Scanning Numbers #1 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner ● Mockist TDD aka “London School” ● Outside-in = following the user interaction
  • 23. Outside-In ● build the system from the "outside-in" ● helps identify top level function/class, entry point to the desired functionality, ● e.g. widget in GUI, link on a web page, or command line flag ● following the user interaction through all the parts of the system PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 24. Scanning Numbers #2 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner Test Mock
  • 25. Mock Scanning Numbers #3 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner Test Mock Test
  • 26. Mock Mock Scanning Numbers #4 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScannerTest Test Test
  • 27. Summary of Outside-In TDD  Working from „outside“ in.  Assume collaborators and mock them.  Verify behaviour, not state.  Design in Red stage.  Follow Tell-Don't-Ask principle. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Franziska Sauerwein, http://slides.com/franziskasauerwein/outside#/
  • 29. Five Types of Test Doubles ● Dummy (Object) ● Fake (Object) ● Stub ● Partial Stub ● Spy ● Mock ● Partial Mock ● Test-Specific Subclass PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 30. How to “Mock” an Object ● by hand ● implement its interface (Eclipse Ctrl-1) ● subclass it (beware complex constructors) ● with java.lang.reflect.Proxy ● since Java 1.3 ● only for interfaces ● nasty for more than 1 method PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 31. Mocking Frameworks ● e.g. Mockito, moq, Sinon.JS, ... ● mock interfaces (Proxy) ● mock non final classes (cglib) import static org.easymock.EasyMock.*; SomeInt mock = createMock(SomeInt.class); expect(mock.someMethod("param")).andReturn(42); replay(mock); // run the test which calls someMethod once verify(mock); PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 32. Double Loop TDD PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 34. Write a failing end-to-end test Nathaniel Pryce, http://www.doc.ic.ac.uk/~np2/teaching/
  • 35. Double Loop TDD Design Process ● create an Acceptance/Guiding Test (red) ● start with top level interaction (from UI) ● discover/design needed collaborators ● stub/mock these dependencies ● implement using TDD ● run Guiding Test to see where to go next ● while Guiding Test is still red ● move down to previously mocked collaborator PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Emily Bache, http://coding-is-like-cooking.info/2013/04/outside-in-development-with-double-loop-tdd/
  • 36. Scanner NumberScanner DigitScanner Scanning Numbers #1 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner Guiding Test
  • 37. Scanner NumberScanner DigitScanner Scanning Numbers #2 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner Test Mock Guiding Test
  • 38. Scanner NumberScanner DigitScanner Scanning Numbers #3 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner Test Mock Guiding Test
  • 39. Mock Scanner NumberScanner DigitScanner Scanning Numbers #4 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner Mock Test Guiding Test Test
  • 40. Mock Scanner NumberScanner DigitScanner Scanning Numbers #5 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScanner Mock Test Guiding Test Test
  • 41. Mock Mock Scanner NumberScanner DigitScanner Scanning Numbers #6 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScannerTest Guiding Test Test Test
  • 42. Mock Mock Scanner NumberScanner DigitScanner Scanning Numbers #7 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Scanner NumberScanner DigitScannerTest Guiding Test Test Test
  • 43. Try it yourself PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 44. Coding Dojo Mindset ● Safe place outside work ● We are here to learn ● Need to slow down ● Focus on doing it right ● Collaborative Game PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 45. Assignment PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 46. Bank OCR ● You work for a bank, which has a machine to assist in reading letters. The machine scans the paper documents, and produces a file with a number of entries which each look like this: ····_··_·····_··_··_··_··_· ··|·_|·_||_||_·|_···||_||_| ··||_··_|··|·_||_|··||_|·_| ● Each entry is 4 lines long, each line has 27 characters. The first 3 lines contain an account number written using pipes and underscores, and the fourth line is blank. Each account number should have 9 digits, all of which should be in the range 1-9. ● Write a program that can take this file and parse it into actual account numbers. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 47. Prepare ● Find a pair. ● Agree on a programming language. ● Get the project from https://bitbucket.org/pkofler/bankocr-kata-setup ● See GuidingTest (failing test) ● Guiding Test is the starting point. ● Work through outer API, outside-in. ● Implement Bank OCR. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 48. Recommended: A Test List ● Use first ten minutes to create list of acceptance test cases (on paper) ● Start each TDD cycle with at least three test cases before beginning to code (paper or text file) PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 49. Apply: Outside-In TDD ● build the system from the "outside-in", following the user interaction through all the parts of the system ● create a Guiding Test ● start with top level interactions ● mock dependencies ● implement using TDD until all tests green ● move inside previously mocked collaborator PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 50. Don't Focus on Getting it Done. F0cus on Doing It Perfectly.
  • 52. Closing Circle ● What did you learn today? ● What surprised you today? ● What will you do differently in the future? PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 53. Study! ● TDD is important. ● You need to study it. ● Good books: PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 54. Peter Kofler @codecopkofler www.code-cop.org PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 55. CC Images ● London https://www.flickr.com/photos/damski/8019978119 ● Bruce http://www.flickr.com/photos/sherpas428/4350620602/ ● pairing http://www.flickr.com/photos/dav/94735395/ ● agenda http://www.flickr.com/photos/24293932@N00/2752221871/ ● wants you http://www.flickr.com/photos/shutter/105497713/ ● drawing https://www.flickr.com/photos/msk13/4108489367 ● Chicago https://www.flickr.com/photos/pedrosz/34886261555/ ● mocks http://www.flickr.com/photos/sneddon/2413980712/ ● loops https://www.flickr.com/photos/fitzharris/7592626086/ ● hands https://www.flickr.com/photos/ninahiironniemi/497993647/ ● dojo http://www.flickr.com/photos/49715404@N00/3267627038/ ● bank https://www.flickr.com/photos/bigmacsc99/4325336251 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY