SlideShare une entreprise Scribd logo
1  sur  7
Télécharger pour lire hors ligne
Case Studies of Test Driven Development (TDD)
● There are lots of benefits documented of doing unit testing
in TDD but it’s important to know the experiences of the
individuals/companies who perform unit testing in TDD
● For that, we’ve asked some questions to the below experts
who’ve been working in test driven development domain
Frederico Gonçalves
Android developer at Babbel
Jeff Langr
Owner at Langr Software Solutions Inc.
J. B. Rainsberger
Business/Software Coach
Case Study 1
Expert- ​Frederico Gonçalves
What’s the difference you’ve noticed in defect rate in unit testing
when you started working in TDD?
Before using TDD there were a lot of things that were caught later on by
QA and thrown back to developers. I started at Babbel right away doing
TDD, so here there’s no improvement measured. In my old company, after
we adopted TDD the issues reported by QA decreased considerably. We
used to have on average 5 issues popping up on QA and this went down to
1 or 2. We also used to have a 95% free-crash rate and it increased to
98%.
According to Bhat and Nagappan’s case study at Microsoft showed
that development time using TDD grew by 15-35%. What is your
experience with development time?
The development time increased for sure, but what we lose in developing
time we gain in less QA and fewer bugs in the long run.
Both Defect rate and Development time impacts on Cost of
development. Have you noticed cost reduction after implementing
TDD at your organization?
Hard to say. We develop for ourselves, meaning we don’t really build apps
for other clients where we would charge per hour. As explained, you
definitely notice an increase in developing time and a decrease in the
number of issues reported by QA. In general, we spend less time releasing
new features and therefore I guess one could say it’s cheaper to develop.
1
In most cases, TDD results in good test coverage and a lasting
regression test suite. Did you experience any increase in test
coverage? If yes, then how much?
Yes definitely. This is actually something we actively measure here at
Babbel. It increased by about 40%.
Case Study 2
 
Expert- Jeff Langr
What’s the difference you’ve noticed in defect rate in unit testing
when you started working in TDD?
I can relate a couple of stories. I worked with an insurance company who
deployed a moderately-sized (~100,000 SLOC) test-driven Java app to
production. In its first 12 months, they uncovered only 15 production
defects in total. This is dramatically less than a typical production
application.
I worked as a Clojure programmer from 2013-2016 using TDD. I did not
code any “logic” defects during this time. We did have integration-related
defects and defects related to the misunderstanding of customer interests.
In the work I do with customers, the code that we test-drive does not exhibit
logic defects for intended behaviour.
2
TDD does not remove all defects. Among other classes of defects, you will
still have integration-related defects, defects related to the
misunderstanding of requirements or missed requirements, and defects for
unexpected interactions, but even these begin to reduce in number when
TDD is employed.
According to Bhat and Nagappan’s case study at Microsoft showed
that development time using TDD grew by 15-35%. What is your
experience with development time?
I believe the studies indicate that TDD creates an increase in “initial
development time” in comparison to other projects. These figures, as far as
I know, do not include the costs of rework due to defects, or other costs
associated with defects; nor do they consider the increased cost in the
long-term development of code when the quality of the code (in absence of
continual refactoring) decreases.
I take little stock in any one study. Most of the studies show similar results,
however, suggests that the costs/values attributed to TDD are reasonably
in line with reality.
From a personal stance, I firmly believe TDD has allowed me to increase
my development speed over time as the codebase for any given project
grows in size. I can and have related anecdotes about how not practising
TDD on efforts increased even after a very short amount of time.
During my Clojure development years, we created a significant amount of
code in a short time using TDD. I do not believe we would have gone any
faster by abandoning TDD, particularly given the dynamic nature of
changing requirements.
3
Both Defect rate and Development time impacts on Cost of
development. Have you noticed cost reduction after implementing
TDD at your organization?
Things like this are always hard to quantify. That our Clojure codebase had
few logic defects indeed meant we had reduced costs in the areas of
rework, defect management, and support. I also believe that we had
reduced costs in terms of time required to understand current code
behaviour.
In most cases, TDD results in good test coverage and a lasting
regression test suite. Did you experience any increase in test
coverage? If yes, then how much?
Since we were doing TDD on most of the Clojure code, our coverage per
cent, at least on the system I worked on, was likely in the high 90% range
by definition. We never measured it, as it was not a relevant number (if
everyone is practising TDD correctly, there is no need to track the
coverage). In the past, I’ve test-driven systems and later come back to
measure code coverage out of curiosity; in these cases, the numbers have
always been in the high 90% range. Certain areas of code–pure view code
with no real logic–end up having low or no coverage, but that’s the point of
removing all logic from it.
4
Case Study 3
Expert- J. B. Rainsberger
What’s the difference you’ve noticed in defect rate in unit testing
when you started working in TDD?
When I started practising TDD, my personal defect rate decreased by over
90%. Clearly, I had a very high defect rate at the time. More importantly,
though, I noticed that when I practised test-first programming (even without
the emphasis on refactoring), I produced different kinds of defects from
what I had done before. I would still produce the occasional very silly
mistake and I would still produce very complicated, difficult-to-diagnose
defects from unexpected behaviour emerging from integrating larger parts
of the system, but 99% of the non-trivial-but-easy-to-understand defects
disappeared because I find those mistakes myself.
I now think more in terms of the cost of mistakes instead of the frequency
of mistakes. Practising TDD helps me reduce the cost of mistakes by
reducing the time between when I make the mistake and when I notice the
mistake. Herein lies a lot of the cost-saving of test-first programming: the
sooner I see the mistake, the more easily I fix it.
According to Bhat and Nagappan’s case study at Microsoft showed
that development time using TDD grew by 15-35%. What is your
experience with development time?
I don’t know the case study well, so I don’t know whether they compare
apples to apples. When I worked at IBM, I worked in a common enterprise
environment that had “code freezes”. Before code freeze, programmers
built new features, and after code freeze, programmers only fixed the most
urgent manager-approved defects. After I started practising TDD, I
5
delivered probably 20% less value up to code freeze, but after code freeze,
I earned the trust of the managers to deliver more features right up until the
date of release. I can’t quantify the additional value of that trust, but I found
it more intuitively valuable over the long term than squeezing out 10% more
code over the short term.
Moreover, given the evolutionary design aspect of TDD, I noticed greater
longer-term benefits, since I could build version 4 on top of the same code
from version 1. I didn’t need to throw everything away every 2-3 years. This
savings certainly compensates for going even 20% slower over the short
term.
Both Defect rate and Development time impacts on Cost of
development. Have you noticed cost reduction after implementing
TDD at your organization?
I mostly noticed increased cost certainty, meaning a large decrease in
unexpected/unplanned costs. Although I didn’t stay at IBM long enough to
witness it myself, I know that when cost uncertainty decreases, then cost
itself also gradually decreases.
In most cases, TDD results in good test coverage and a lasting
regression test suite. Did you experience any increase in test
coverage? If yes, then how much?
The difference was night and day. When I practice TDD, I get the 85%
coverage that matters most like a natural part of the process of writing
code.
6

Contenu connexe

Tendances

Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
Joe Wilson
 

Tendances (20)

Introduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed ShreefIntroduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed Shreef
 
Coding standards and guidelines
Coding standards and guidelinesCoding standards and guidelines
Coding standards and guidelines
 
Coding standard
Coding standardCoding standard
Coding standard
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
 
Most Asked Java Interview Question and Answer
Most Asked Java Interview Question and AnswerMost Asked Java Interview Question and Answer
Most Asked Java Interview Question and Answer
 
L14 exception handling
L14 exception handlingL14 exception handling
L14 exception handling
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Workshop unit test
Workshop   unit testWorkshop   unit test
Workshop unit test
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
TDD Best Practices
TDD Best PracticesTDD Best Practices
TDD Best Practices
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)
 
Test Automation Pyramid
Test Automation PyramidTest Automation Pyramid
Test Automation Pyramid
 
Nunit
NunitNunit
Nunit
 
Defect life cycle and Defect Status Life Cycle
Defect life cycle and Defect Status Life CycleDefect life cycle and Defect Status Life Cycle
Defect life cycle and Defect Status Life Cycle
 
Static Code Analysis
Static Code AnalysisStatic Code Analysis
Static Code Analysis
 
Coding
CodingCoding
Coding
 
Google test training
Google test trainingGoogle test training
Google test training
 

Similaire à Case studies of Test Driven Development

Comparison between Test-Driven Development and Conventional Development: A Ca...
Comparison between Test-Driven Development and Conventional Development: A Ca...Comparison between Test-Driven Development and Conventional Development: A Ca...
Comparison between Test-Driven Development and Conventional Development: A Ca...
IJERA Editor
 

Similaire à Case studies of Test Driven Development (20)

The Essentials Of Test Driven Development
The Essentials Of Test Driven Development The Essentials Of Test Driven Development
The Essentials Of Test Driven Development
 
Tdd
TddTdd
Tdd
 
Comparison between Test-Driven Development and Conventional Development: A Ca...
Comparison between Test-Driven Development and Conventional Development: A Ca...Comparison between Test-Driven Development and Conventional Development: A Ca...
Comparison between Test-Driven Development and Conventional Development: A Ca...
 
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
 
Boast the Potential of DevOps with CI CD
Boast the Potential of DevOps with CI CDBoast the Potential of DevOps with CI CD
Boast the Potential of DevOps with CI CD
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Markus Clermont - Surviving in an Agile Environment - Google - SoftTest Ireland
Markus Clermont - Surviving in an Agile Environment - Google - SoftTest IrelandMarkus Clermont - Surviving in an Agile Environment - Google - SoftTest Ireland
Markus Clermont - Surviving in an Agile Environment - Google - SoftTest Ireland
 
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
 
The productivity of testing in software development life cycle
The productivity of testing in software development life cycleThe productivity of testing in software development life cycle
The productivity of testing in software development life cycle
 
DevOps and Security, a Match Made in Heaven
DevOps and Security, a Match Made in HeavenDevOps and Security, a Match Made in Heaven
DevOps and Security, a Match Made in Heaven
 
How BDD enables True CI/CD
How BDD enables True CI/CDHow BDD enables True CI/CD
How BDD enables True CI/CD
 
Top Challenges Faced During DevOps Implementation and How to Overcome Them
Top Challenges Faced During DevOps Implementation and How to Overcome ThemTop Challenges Faced During DevOps Implementation and How to Overcome Them
Top Challenges Faced During DevOps Implementation and How to Overcome Them
 
TDD in Agile
TDD in AgileTDD in Agile
TDD in Agile
 
Myths and reality about software testing
Myths and reality about software testingMyths and reality about software testing
Myths and reality about software testing
 
Best 8 Practices to Ensure Quality Assurance (QA) in Software Testing
Best 8 Practices to Ensure Quality Assurance (QA) in Software TestingBest 8 Practices to Ensure Quality Assurance (QA) in Software Testing
Best 8 Practices to Ensure Quality Assurance (QA) in Software Testing
 
Examining test coverage in software testing (1)
Examining test coverage in software testing (1)Examining test coverage in software testing (1)
Examining test coverage in software testing (1)
 
EFFECTIVE TEST CASE DESING: A REVIEW
EFFECTIVE TEST CASE DESING: A REVIEWEFFECTIVE TEST CASE DESING: A REVIEW
EFFECTIVE TEST CASE DESING: A REVIEW
 
Test Driven Development - Overview and Adoption
Test Driven Development - Overview and AdoptionTest Driven Development - Overview and Adoption
Test Driven Development - Overview and Adoption
 
Bdd masterclass
Bdd masterclassBdd masterclass
Bdd masterclass
 
Mastering BDD - Eran Kinsbruner Workshop Quest 2018
Mastering BDD - Eran Kinsbruner Workshop Quest 2018Mastering BDD - Eran Kinsbruner Workshop Quest 2018
Mastering BDD - Eran Kinsbruner Workshop Quest 2018
 

Plus de Simform

Plus de Simform (20)

SaaS Architecture.pdf
SaaS Architecture.pdfSaaS Architecture.pdf
SaaS Architecture.pdf
 
VMs vs. Containers.pdf
VMs vs. Containers.pdfVMs vs. Containers.pdf
VMs vs. Containers.pdf
 
Benefits of Containerization.pdf
Benefits of Containerization.pdfBenefits of Containerization.pdf
Benefits of Containerization.pdf
 
Serverless Frameworks.pdf
Serverless Frameworks.pdfServerless Frameworks.pdf
Serverless Frameworks.pdf
 
Microservice Design Patterns.pdf
Microservice Design Patterns.pdfMicroservice Design Patterns.pdf
Microservice Design Patterns.pdf
 
Microservices Examples.pdf
Microservices Examples.pdfMicroservices Examples.pdf
Microservices Examples.pdf
 
Container Orchestration.pdf
Container Orchestration.pdfContainer Orchestration.pdf
Container Orchestration.pdf
 
AWS Fargate vs. Lambda.pdf
AWS Fargate vs. Lambda.pdfAWS Fargate vs. Lambda.pdf
AWS Fargate vs. Lambda.pdf
 
SaaS Development.pdf
SaaS Development.pdfSaaS Development.pdf
SaaS Development.pdf
 
Containerization Best Practices.pdf
Containerization Best Practices.pdfContainerization Best Practices.pdf
Containerization Best Practices.pdf
 
Web Application Development Cost.pdf
Web Application Development Cost.pdfWeb Application Development Cost.pdf
Web Application Development Cost.pdf
 
Containerization Use Cases.pdf
Containerization Use Cases.pdfContainerization Use Cases.pdf
Containerization Use Cases.pdf
 
Database DevOps.pdf
Database DevOps.pdfDatabase DevOps.pdf
Database DevOps.pdf
 
Leading DevOps Tools for 2022.pdf
Leading DevOps Tools for 2022.pdfLeading DevOps Tools for 2022.pdf
Leading DevOps Tools for 2022.pdf
 
Agile vs. DevOps.pdf
Agile vs. DevOps.pdfAgile vs. DevOps.pdf
Agile vs. DevOps.pdf
 
DevOps Automation.pdf
DevOps Automation.pdfDevOps Automation.pdf
DevOps Automation.pdf
 
How to Build Real-time Application with Node.js.pdf
How to Build Real-time Application with Node.js.pdfHow to Build Real-time Application with Node.js.pdf
How to Build Real-time Application with Node.js.pdf
 
Microservice Best Practices The 8020 Way.pdf
Microservice Best Practices The 8020 Way.pdfMicroservice Best Practices The 8020 Way.pdf
Microservice Best Practices The 8020 Way.pdf
 
Docker Use Cases.pdf
Docker Use Cases.pdfDocker Use Cases.pdf
Docker Use Cases.pdf
 
Microservices Design Principles.pdf
Microservices Design Principles.pdfMicroservices Design Principles.pdf
Microservices Design Principles.pdf
 

Dernier

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Dernier (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

Case studies of Test Driven Development

  • 1. Case Studies of Test Driven Development (TDD) ● There are lots of benefits documented of doing unit testing in TDD but it’s important to know the experiences of the individuals/companies who perform unit testing in TDD ● For that, we’ve asked some questions to the below experts who’ve been working in test driven development domain Frederico Gonçalves Android developer at Babbel Jeff Langr Owner at Langr Software Solutions Inc. J. B. Rainsberger Business/Software Coach
  • 2. Case Study 1 Expert- ​Frederico Gonçalves What’s the difference you’ve noticed in defect rate in unit testing when you started working in TDD? Before using TDD there were a lot of things that were caught later on by QA and thrown back to developers. I started at Babbel right away doing TDD, so here there’s no improvement measured. In my old company, after we adopted TDD the issues reported by QA decreased considerably. We used to have on average 5 issues popping up on QA and this went down to 1 or 2. We also used to have a 95% free-crash rate and it increased to 98%. According to Bhat and Nagappan’s case study at Microsoft showed that development time using TDD grew by 15-35%. What is your experience with development time? The development time increased for sure, but what we lose in developing time we gain in less QA and fewer bugs in the long run. Both Defect rate and Development time impacts on Cost of development. Have you noticed cost reduction after implementing TDD at your organization? Hard to say. We develop for ourselves, meaning we don’t really build apps for other clients where we would charge per hour. As explained, you definitely notice an increase in developing time and a decrease in the number of issues reported by QA. In general, we spend less time releasing new features and therefore I guess one could say it’s cheaper to develop. 1
  • 3. In most cases, TDD results in good test coverage and a lasting regression test suite. Did you experience any increase in test coverage? If yes, then how much? Yes definitely. This is actually something we actively measure here at Babbel. It increased by about 40%. Case Study 2   Expert- Jeff Langr What’s the difference you’ve noticed in defect rate in unit testing when you started working in TDD? I can relate a couple of stories. I worked with an insurance company who deployed a moderately-sized (~100,000 SLOC) test-driven Java app to production. In its first 12 months, they uncovered only 15 production defects in total. This is dramatically less than a typical production application. I worked as a Clojure programmer from 2013-2016 using TDD. I did not code any “logic” defects during this time. We did have integration-related defects and defects related to the misunderstanding of customer interests. In the work I do with customers, the code that we test-drive does not exhibit logic defects for intended behaviour. 2
  • 4. TDD does not remove all defects. Among other classes of defects, you will still have integration-related defects, defects related to the misunderstanding of requirements or missed requirements, and defects for unexpected interactions, but even these begin to reduce in number when TDD is employed. According to Bhat and Nagappan’s case study at Microsoft showed that development time using TDD grew by 15-35%. What is your experience with development time? I believe the studies indicate that TDD creates an increase in “initial development time” in comparison to other projects. These figures, as far as I know, do not include the costs of rework due to defects, or other costs associated with defects; nor do they consider the increased cost in the long-term development of code when the quality of the code (in absence of continual refactoring) decreases. I take little stock in any one study. Most of the studies show similar results, however, suggests that the costs/values attributed to TDD are reasonably in line with reality. From a personal stance, I firmly believe TDD has allowed me to increase my development speed over time as the codebase for any given project grows in size. I can and have related anecdotes about how not practising TDD on efforts increased even after a very short amount of time. During my Clojure development years, we created a significant amount of code in a short time using TDD. I do not believe we would have gone any faster by abandoning TDD, particularly given the dynamic nature of changing requirements. 3
  • 5. Both Defect rate and Development time impacts on Cost of development. Have you noticed cost reduction after implementing TDD at your organization? Things like this are always hard to quantify. That our Clojure codebase had few logic defects indeed meant we had reduced costs in the areas of rework, defect management, and support. I also believe that we had reduced costs in terms of time required to understand current code behaviour. In most cases, TDD results in good test coverage and a lasting regression test suite. Did you experience any increase in test coverage? If yes, then how much? Since we were doing TDD on most of the Clojure code, our coverage per cent, at least on the system I worked on, was likely in the high 90% range by definition. We never measured it, as it was not a relevant number (if everyone is practising TDD correctly, there is no need to track the coverage). In the past, I’ve test-driven systems and later come back to measure code coverage out of curiosity; in these cases, the numbers have always been in the high 90% range. Certain areas of code–pure view code with no real logic–end up having low or no coverage, but that’s the point of removing all logic from it. 4
  • 6. Case Study 3 Expert- J. B. Rainsberger What’s the difference you’ve noticed in defect rate in unit testing when you started working in TDD? When I started practising TDD, my personal defect rate decreased by over 90%. Clearly, I had a very high defect rate at the time. More importantly, though, I noticed that when I practised test-first programming (even without the emphasis on refactoring), I produced different kinds of defects from what I had done before. I would still produce the occasional very silly mistake and I would still produce very complicated, difficult-to-diagnose defects from unexpected behaviour emerging from integrating larger parts of the system, but 99% of the non-trivial-but-easy-to-understand defects disappeared because I find those mistakes myself. I now think more in terms of the cost of mistakes instead of the frequency of mistakes. Practising TDD helps me reduce the cost of mistakes by reducing the time between when I make the mistake and when I notice the mistake. Herein lies a lot of the cost-saving of test-first programming: the sooner I see the mistake, the more easily I fix it. According to Bhat and Nagappan’s case study at Microsoft showed that development time using TDD grew by 15-35%. What is your experience with development time? I don’t know the case study well, so I don’t know whether they compare apples to apples. When I worked at IBM, I worked in a common enterprise environment that had “code freezes”. Before code freeze, programmers built new features, and after code freeze, programmers only fixed the most urgent manager-approved defects. After I started practising TDD, I 5
  • 7. delivered probably 20% less value up to code freeze, but after code freeze, I earned the trust of the managers to deliver more features right up until the date of release. I can’t quantify the additional value of that trust, but I found it more intuitively valuable over the long term than squeezing out 10% more code over the short term. Moreover, given the evolutionary design aspect of TDD, I noticed greater longer-term benefits, since I could build version 4 on top of the same code from version 1. I didn’t need to throw everything away every 2-3 years. This savings certainly compensates for going even 20% slower over the short term. Both Defect rate and Development time impacts on Cost of development. Have you noticed cost reduction after implementing TDD at your organization? I mostly noticed increased cost certainty, meaning a large decrease in unexpected/unplanned costs. Although I didn’t stay at IBM long enough to witness it myself, I know that when cost uncertainty decreases, then cost itself also gradually decreases. In most cases, TDD results in good test coverage and a lasting regression test suite. Did you experience any increase in test coverage? If yes, then how much? The difference was night and day. When I practice TDD, I get the 85% coverage that matters most like a natural part of the process of writing code. 6