SlideShare una empresa de Scribd logo
1 de 24
Dror Helper
Senior consultant
Tuesday, July 23, 2013
What’s wrong with TDD
• Software developer & Architect > 10 years
• Senior Consultant
• Agile evangelist
• Blogger – http://blog.drorhelper.com
About.Me
What is a unit test?
A method (Code)
that
tests specific functionality,
Has
clear pass/fail criteria
and
runs in isolation
This is a unit test!
[TestMethod]
public void CheckPassword_ValidUser_ReturnTrue()
{
bool result = CheckPassword(“user”, “pass”);
Assert.IsTrue(result);
}
What about TDD?
Red
Write a failing test
Green
Make the test pass
Refactor
Clean duplicates and tidy up your code
In other words:
Write
new
Test
Run
Test
Write
code
Run
Tests
Refactor
WHY DOESN’T EVERYBODY DOING IT?
If it’s so simple
7
Writing tests takes time which I don’t have
or
Writing tests is a waste of time
and besides
Testing is a tester’s job
Reason #1 – it got “Tests” in it
But it takes too much time
120%
135%
115%
125%
0%
20%
40%
60%
80%
100%
120%
140%
IBM: Drivers MS: Windows MS: MSN MS: VS
Time taken to code a feature
WithoutTDD Using TDD
Is it a waste of time?
61%
38%
24%
9%
0%
20%
40%
60%
80%
100%
120%
140%
IBM: Drivers MS: Windows MS: MSN MS: VS
Using Test Driven Design
Time To Code Feature Defect density of team
Tests costs more time
However
Development takes less Time:
• Less defects
• Rarely need to invoke the debugger
• Every line has a test
• Overcome analysis-paralysis
So do testing waste time?
Hope Driven Development
Can you guarantee there won’t be regression?
How do you know that no stupid bugs were
created?
Not testing is a decision
Writing tests before coding is counterintuitive
How can you know what you’re going to write?
Planning for failure feels wrong
Reason #2 – Tests before code is wierd
• Seems more logical
• Don’t confuse me with new methodologies
• Just as good as tests before
And Finally - no one would ever know
It’s hard to verify were written using TDD
I’ll write the tests after
When you write the tests after the code
You Miss the point of TDD:
Emergent Design
Only write the code you
need
TDD is not about the tests
Development Driven Tests
Video streaming
UI
Closed architectures
Legacy code
If I can’t write tests – how can I use TDD?
Reason # 3 – Not everything is testable
You can still test business logic
Use mocking solutions
Remember – TDD is iterative
Not everything is testable - but
If you need to
change your code
You have to
Change your tests
Reason #4 – TDD locks design
Ideally
Only requirement change (or defect)
would cause tests to break
It means
You have to know how to write robust unit tests
Tests are code too
Requires time investment
Counter intuitive
New skill to learn
Might not work for all scenarios
TDD is:
a safety net against regression
prevents defects during development
Enabler of modular, testable code
Only write the code you need
Takes less time than DDT
If done correctly …
TDD is also:
There are many excuses
not to use TDD
At least try it out before deciding against it.
Presenter contact details
C: 972.05.7668543
e: drorh@codevalue.net
B: blog.drorhelper.com
w: www.codevalue.net

Más contenido relacionado

La actualidad más candente

Exploratory testing
Exploratory testingExploratory testing
Exploratory testing
ISsoft
 
TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?
Dmitriy Nesteryuk
 

La actualidad más candente (20)

Code Review Matters and Manners
Code Review Matters and MannersCode Review Matters and Manners
Code Review Matters and Manners
 
PHP unit testing - good and bad practices
PHP unit testing - good and bad practicesPHP unit testing - good and bad practices
PHP unit testing - good and bad practices
 
Testing strategies for legacy code
Testing strategies for legacy codeTesting strategies for legacy code
Testing strategies for legacy code
 
Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit Testing
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
Introduction to test programming
Introduction to test programmingIntroduction to test programming
Introduction to test programming
 
Writing Tests Effectively
Writing Tests EffectivelyWriting Tests Effectively
Writing Tests Effectively
 
TDD for the masses
TDD for the massesTDD for the masses
TDD for the masses
 
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013
 
Los diez mandamientos de TDD
Los diez mandamientos de TDDLos diez mandamientos de TDD
Los diez mandamientos de TDD
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
David Hayman - Say What? Testing a Voice Avtivated System - EuroSTAR 2010
David Hayman - Say What? Testing a Voice Avtivated System - EuroSTAR 2010David Hayman - Say What? Testing a Voice Avtivated System - EuroSTAR 2010
David Hayman - Say What? Testing a Voice Avtivated System - EuroSTAR 2010
 
Simple testable code
Simple testable codeSimple testable code
Simple testable code
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Exploratory testing workshop
Exploratory testing workshopExploratory testing workshop
Exploratory testing workshop
 
Mobile Development - Unit and Automation Testing
Mobile Development - Unit and Automation TestingMobile Development - Unit and Automation Testing
Mobile Development - Unit and Automation Testing
 
Exploratory Testing Explained
Exploratory Testing ExplainedExploratory Testing Explained
Exploratory Testing Explained
 
Exploratory testing
Exploratory testingExploratory testing
Exploratory testing
 
TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?
 
Programming the Programmer
Programming the ProgrammerProgramming the Programmer
Programming the Programmer
 

Similar a The problem with tdd

Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
bhochhi
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
Lim Chanmann
 

Similar a The problem with tdd (20)

Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Tdd
TddTdd
Tdd
 
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
 
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
 
Automated Unit Testing and TDD
Automated Unit Testing and TDDAutomated Unit Testing and TDD
Automated Unit Testing and 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
 
Tdd practices
Tdd practicesTdd practices
Tdd practices
 
Pair programming and introduction to TDD
Pair programming and introduction to TDDPair programming and introduction to TDD
Pair programming and introduction to TDD
 
Unit Testing and TDD 2017
Unit Testing and TDD 2017Unit Testing and TDD 2017
Unit Testing and TDD 2017
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven Development
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven Development
 
TDD and Unit Testing in Golang
TDD and Unit Testing in GolangTDD and Unit Testing in Golang
TDD and Unit Testing in Golang
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
TDD, the way to better software | Dan Ursu | CodeWay 2015
TDD, the way to better software | Dan Ursu | CodeWay 2015TDD, the way to better software | Dan Ursu | CodeWay 2015
TDD, the way to better software | Dan Ursu | CodeWay 2015
 
Test driven development v1.0
Test driven development v1.0Test driven development v1.0
Test driven development v1.0
 
Common mistakes in tdd can you guess
Common mistakes in tdd   can you guessCommon mistakes in tdd   can you guess
Common mistakes in tdd can you guess
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy
 

Más de Dror Helper

Más de Dror Helper (20)

Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent code
 
The secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you aboutThe secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you about
 
Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
 
A software developer guide to working with aws
A software developer guide to working with awsA software developer guide to working with aws
A software developer guide to working with aws
 
The secret unit testing tools no one has ever told you about
The secret unit testing tools no one has ever told you aboutThe secret unit testing tools no one has ever told you about
The secret unit testing tools no one has ever told you about
 
The role of the architect in agile
The role of the architect in agileThe role of the architect in agile
The role of the architect in agile
 
Harnessing the power of aws using dot net core
Harnessing the power of aws using dot net coreHarnessing the power of aws using dot net core
Harnessing the power of aws using dot net core
 
Developing multi-platform microservices using .NET core
 Developing multi-platform microservices using .NET core Developing multi-platform microservices using .NET core
Developing multi-platform microservices using .NET core
 
Harnessing the power of aws using dot net
Harnessing the power of aws using dot netHarnessing the power of aws using dot net
Harnessing the power of aws using dot net
 
Secret unit testing tools no one ever told you about
Secret unit testing tools no one ever told you aboutSecret unit testing tools no one ever told you about
Secret unit testing tools no one ever told you about
 
C++ Unit testing - the good, the bad & the ugly
C++ Unit testing - the good, the bad & the uglyC++ Unit testing - the good, the bad & the ugly
C++ Unit testing - the good, the bad & the ugly
 
Working with c++ legacy code
Working with c++ legacy codeWorking with c++ legacy code
Working with c++ legacy code
 
Visual Studio tricks every dot net developer should know
Visual Studio tricks every dot net developer should knowVisual Studio tricks every dot net developer should know
Visual Studio tricks every dot net developer should know
 
Secret unit testing tools
Secret unit testing toolsSecret unit testing tools
Secret unit testing tools
 
Electronics 101 for software developers
Electronics 101 for software developersElectronics 101 for software developers
Electronics 101 for software developers
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
 
Building unit tests correctly
Building unit tests correctlyBuilding unit tests correctly
Building unit tests correctly
 
Who’s afraid of WinDbg
Who’s afraid of WinDbgWho’s afraid of WinDbg
Who’s afraid of WinDbg
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

The problem with tdd

  • 1. Dror Helper Senior consultant Tuesday, July 23, 2013 What’s wrong with TDD
  • 2. • Software developer & Architect > 10 years • Senior Consultant • Agile evangelist • Blogger – http://blog.drorhelper.com About.Me
  • 3. What is a unit test? A method (Code) that tests specific functionality, Has clear pass/fail criteria and runs in isolation
  • 4. This is a unit test! [TestMethod] public void CheckPassword_ValidUser_ReturnTrue() { bool result = CheckPassword(“user”, “pass”); Assert.IsTrue(result); }
  • 5. What about TDD? Red Write a failing test Green Make the test pass Refactor Clean duplicates and tidy up your code
  • 7. WHY DOESN’T EVERYBODY DOING IT? If it’s so simple 7
  • 8. Writing tests takes time which I don’t have or Writing tests is a waste of time and besides Testing is a tester’s job Reason #1 – it got “Tests” in it
  • 9. But it takes too much time 120% 135% 115% 125% 0% 20% 40% 60% 80% 100% 120% 140% IBM: Drivers MS: Windows MS: MSN MS: VS Time taken to code a feature WithoutTDD Using TDD
  • 10. Is it a waste of time? 61% 38% 24% 9% 0% 20% 40% 60% 80% 100% 120% 140% IBM: Drivers MS: Windows MS: MSN MS: VS Using Test Driven Design Time To Code Feature Defect density of team
  • 11. Tests costs more time However Development takes less Time: • Less defects • Rarely need to invoke the debugger • Every line has a test • Overcome analysis-paralysis So do testing waste time?
  • 12. Hope Driven Development Can you guarantee there won’t be regression? How do you know that no stupid bugs were created? Not testing is a decision
  • 13. Writing tests before coding is counterintuitive How can you know what you’re going to write? Planning for failure feels wrong Reason #2 – Tests before code is wierd
  • 14. • Seems more logical • Don’t confuse me with new methodologies • Just as good as tests before And Finally - no one would ever know It’s hard to verify were written using TDD I’ll write the tests after
  • 15. When you write the tests after the code You Miss the point of TDD: Emergent Design Only write the code you need TDD is not about the tests
  • 17. Video streaming UI Closed architectures Legacy code If I can’t write tests – how can I use TDD? Reason # 3 – Not everything is testable
  • 18. You can still test business logic Use mocking solutions Remember – TDD is iterative Not everything is testable - but
  • 19. If you need to change your code You have to Change your tests Reason #4 – TDD locks design
  • 20. Ideally Only requirement change (or defect) would cause tests to break It means You have to know how to write robust unit tests Tests are code too
  • 21. Requires time investment Counter intuitive New skill to learn Might not work for all scenarios TDD is:
  • 22. a safety net against regression prevents defects during development Enabler of modular, testable code Only write the code you need Takes less time than DDT If done correctly … TDD is also:
  • 23. There are many excuses not to use TDD At least try it out before deciding against it.
  • 24. Presenter contact details C: 972.05.7668543 e: drorh@codevalue.net B: blog.drorhelper.com w: www.codevalue.net

Notas del editor

  1. Taken from http://research.microsoft.com/en-us/projects/esm/nagappan_tdd.pdfRealizing quality improvement through test driven development: results and experiences of four industrial teamsPublished online: 27 February 2008
  2. Taken from http://research.microsoft.com/en-us/projects/esm/nagappan_tdd.pdfRealizing quality improvement through test driven development: results and experiences of four industrial teamsPublished online: 27 February 2008
  3. Only write the code you needEmergent designDesign during development