SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
CODE QUALITY
AND
TESTABILITY
WITH TDD
TDD - A
SMALL
BACKGROU
ND
 It was created rediscovered by Kent
Beck in 2003, also the creator of
Extreme Programming
 It was one of the first programming
techniques introduced to XP
 Values of XP:
 Simplicity
 Communication
 Feedback
 Respect
 Courage
THREE
RULES OF
TDD
You are not allowed to write any
production code unless it is to
make a failing unit test pass.
You are not allowed to write any
more of a unit test than is
sufficient to fail; and compilation
failures are failures.
You are not allowed to write any
more production code than is
sufficient to pass the one failing
unit test.
HOW CAN TDD
HELP TO
IMPROVE OUR
CODE?
TESTS
WRITTEN
UPFRONT
Better planned solution No more code than
actually needed
Less code complexity Promotes SE principles
such as YAGNI, KISS and
SOLID
 Every TDD cycle includes refactoring
 Safety net for code refactoring
 Fast feedback
HOW CAN TDD
HELP TO
IMPROVE
TESTABILITY?
UNIT TESTS
SHOULD…
Test behaviour, not methods
Be Small and fast
Have good naming
Be well grained
Predictable
Every single method and module in the code base is
testable by default
Tests become granular and easy to read
Each test fail for one reason and one reason
TDD IS
ABOUT
PROBLEM
SOLVING
"Problem solving is the process of
breaking problems down into smaller and
more manageable parts. As the large
problem is broken down into smaller
parts, each part becomes more specific.
These individual solutions to smaller
problems are then combined to solve the
bigger problem. Problem solving is also
referred to as analysing the problem to be
solved."
TDD
IMPROVES
THE
PRODUCT
QUALITY
Tests are
present since
the beginning
Test are driven
by requirements
Test suite
becomes a living
documentation

Contenu connexe

Similaire à Improving code quality and testability wiht TDD

Test Driven Development by Sameer Arora
Test Driven Development by Sameer AroraTest Driven Development by Sameer Arora
Test Driven Development by Sameer Arora
Xebia IT Architects
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
Lim Chanmann
 

Similaire à Improving code quality and testability wiht TDD (20)

TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDD
 
Test Driven Development by Sameer Arora
Test Driven Development by Sameer AroraTest Driven Development by Sameer Arora
Test Driven Development by Sameer Arora
 
xUnit and TDD: Why and How in Enterprise Software, August 2012
xUnit and TDD: Why and How in Enterprise Software, August 2012xUnit and TDD: Why and How in Enterprise Software, August 2012
xUnit and TDD: Why and How in Enterprise Software, August 2012
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Tdd red-green-refactor
Tdd red-green-refactorTdd red-green-refactor
Tdd red-green-refactor
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD)
 
Unit Testing, TDD and the Walking Skeleton
Unit Testing, TDD and the Walking SkeletonUnit Testing, TDD and the Walking Skeleton
Unit Testing, TDD and the Walking Skeleton
 
Test-driven development & Behavior-driven development basics
Test-driven development & Behavior-driven development basicsTest-driven development & Behavior-driven development basics
Test-driven development & Behavior-driven development basics
 
Tdd
TddTdd
Tdd
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
tem7
tem7tem7
tem7
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
 
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
Ian Cooper webinar for DDD Iran: Kent beck style tdd   seven years afterIan Cooper webinar for DDD Iran: Kent beck style tdd   seven years after
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
 
Bdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propriBdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propri
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 
Pair programming and introduction to TDD
Pair programming and introduction to TDDPair programming and introduction to TDD
Pair programming and introduction to TDD
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Tdd
TddTdd
Tdd
 

Dernier

Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
Kamal Acharya
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
MohammadAliNayeem
 

Dernier (20)

Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
 
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdfBURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
 
How to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdfHow to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdf
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Multivibrator and its types defination and usges.pptx
Multivibrator and its types defination and usges.pptxMultivibrator and its types defination and usges.pptx
Multivibrator and its types defination and usges.pptx
 
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
 
Theory for How to calculation capacitor bank
Theory for How to calculation capacitor bankTheory for How to calculation capacitor bank
Theory for How to calculation capacitor bank
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
 
Intelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsIntelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent Acts
 
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
 
Operating System chapter 9 (Virtual Memory)
Operating System chapter 9 (Virtual Memory)Operating System chapter 9 (Virtual Memory)
Operating System chapter 9 (Virtual Memory)
 
Electrical shop management system project report.pdf
Electrical shop management system project report.pdfElectrical shop management system project report.pdf
Electrical shop management system project report.pdf
 
ANSI(ST)-III_Manufacturing-I_05052020.pdf
ANSI(ST)-III_Manufacturing-I_05052020.pdfANSI(ST)-III_Manufacturing-I_05052020.pdf
ANSI(ST)-III_Manufacturing-I_05052020.pdf
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
Online book store management system project.pdf
Online book store management system project.pdfOnline book store management system project.pdf
Online book store management system project.pdf
 
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
ChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdfChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdf
 

Improving code quality and testability wiht TDD

  • 2. TDD - A SMALL BACKGROU ND  It was created rediscovered by Kent Beck in 2003, also the creator of Extreme Programming  It was one of the first programming techniques introduced to XP  Values of XP:  Simplicity  Communication  Feedback  Respect  Courage
  • 3.
  • 4. THREE RULES OF TDD You are not allowed to write any production code unless it is to make a failing unit test pass. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
  • 5. HOW CAN TDD HELP TO IMPROVE OUR CODE?
  • 6. TESTS WRITTEN UPFRONT Better planned solution No more code than actually needed Less code complexity Promotes SE principles such as YAGNI, KISS and SOLID
  • 7.  Every TDD cycle includes refactoring  Safety net for code refactoring  Fast feedback
  • 8. HOW CAN TDD HELP TO IMPROVE TESTABILITY?
  • 9.
  • 10. UNIT TESTS SHOULD… Test behaviour, not methods Be Small and fast Have good naming Be well grained Predictable
  • 11.
  • 12. Every single method and module in the code base is testable by default Tests become granular and easy to read Each test fail for one reason and one reason
  • 13.
  • 14.
  • 15.
  • 16. TDD IS ABOUT PROBLEM SOLVING "Problem solving is the process of breaking problems down into smaller and more manageable parts. As the large problem is broken down into smaller parts, each part becomes more specific. These individual solutions to smaller problems are then combined to solve the bigger problem. Problem solving is also referred to as analysing the problem to be solved."
  • 17. TDD IMPROVES THE PRODUCT QUALITY Tests are present since the beginning Test are driven by requirements Test suite becomes a living documentation