The document discusses the importance of testing software through test-driven development (TDD). It provides examples of costly software bugs from companies like Knight Capital Group, NASA, and Toyota to illustrate why testing is important. The document then covers TDD concepts like unit testing, the red-green-refactor process, writing simple tests, and how TDD can improve code quality but may increase initial development time. Studies from Microsoft and IBM found defects decreased by 40-90% with TDD, though development time increased by 15-35%. While TDD provides benefits, it may not be applicable for all projects or appropriate if used rigidly.
7. The Importance of Testing
7
@spinelli_edu
Knight Capital Group's
In August 2012 Knight
Capital Group Inc., one of
America’s largest trading
firms, mistakenly sent out
more than four million
stock orders in less than an
hour.
The software bug caused
over $440 million in losses,
which is almost four times
what the company made in
2011.
NASA - Mariner 1
When US to send a
spacecraft to Venus. A
hyphen in coded computer
instructions in the data
editing program, resulted in
incorrect guidance signals
being sent to the spacecraft.
The cost for the rocket was
reportedly more than $18
million at the time.
Toyota Recall
Toyota ended up recalling
more than 9 million cars
worldwide in 2010, but it
wasn't because of a
mechanical issue. The cars
had a software bug that
caused a lag in the
anti-lock-brake system. Due
to increased incentive
campaigns, legal liabilities,
and marketing efforts, the
recalls were estimated to
cost Toyota as much as $3
billion.
8. Unit Test
8
➔ Fast
➔ Automatic
➔ Facilitates Change
➔ Simplifies Integration
@spinelli_edu
14. Why developers don’t use TDD
14
➔ Management doesn’t allow us
➔ Not enough time to write tests
➔ My team disagrees whether we should
use TDD
➔ Return On Investment in TDD isn’t
proved
➔ Slow build process
➔ We tried but it didn’t work
➔ I don’t know all requirements upfront to
write all tests @spinelli_edu
15. Microsoft and IBM
Case study at Microsoft and
IBM and the results indicated
that the number of
four-product defects
decreased by 40-90% over
similar projects that did not
use TDD. However, the study
also showed TDD increased
the initial development time
by 15% to 35%.
Does TDD really help?
15
@spinelli_edu
More Tests
TDD increases code quality,
provides greater ease of
maintenance, and helps
produce 33% more testing
compared to traditional
approaches.
Programmers
The code had coverage
ranging from 92% to 98%. A
qualitative analysis showed
that 87.5% of programmers
believe that TDD facilitated
the understanding of the
requirements and 95.8%
believe that TDD reduced the
time spent debugging.
However, only 50% believe
that TDD helps to decrease
development time. About
quality, 92% believe that TDD
helps maintain a quality code.
16. When TDD doesn't Work
16
➔ Low Complexity
➔ Domain of Implementation
➔ TDD All Time
➔ 100% code coverage
➔ Test First vs TDD
@spinelli_edu