And the years passed,
and features accumulated
And then I introduced code coverage
A few hundred tests later
In the beginning,
all was well
Testing everything takes
only a few minutes
I'm so smart,
I know and remember all my code !
TODO:
- Design
- Code
- Test
- Document
- Everything
Which Lead to a small problem
GWT UI
Things kept on
BREAKING !!!
I wanted to make an
open source project
to explore some of my ideas
Model Driven
Fast Application Development
There were a few problems:
- Remembering all my code wasn't an option anymore
- I found bugs that I had introduced 5 features ago.
- A manual regression took an hour to run (boring)
Dynamic Compilation
Swing UI
I wish I had a tester
to delegate all this testing...
Man, if I released
this software now,
I'd look like an idiot...
I sat down and started
writing tests for
all my classes
Initial Results
- Found plenty of defects just waiting to be uncovered.
- I could make changes deep in the framework and know exactly what would break within 30 seconds.
I can't believe the number of defects I found,
even in very simple code.
and I thought I was smart
The Road to
Test Driven Development
A whole month without
adding new features,
yawn..
TDD = Test
Driven Development
Have a computer run all the boring stuff
An experience report on what TDD did
for my open source project
Insert shameless plug here
99.9% Coverage!
by Steve McDuff
Write test code ?
Why not, I like to write code.
I read about this TDD concept...
But I never got to really try it...
Even branch coverage
uncovered defects.
I should be able to ship this code now just by looking at those results
right ?
- Found plenty of dead code and half completed classes
No way I'm going to spend time
writing tests for dead code
and useless classes.
Go Go Gadget Trash Bin
What if I have a big team?
WRONG !
Why don't I just give it a real try
Unavoidable facts of life:
- Taxes
- Death
- Software Developer's over optimism
We have people dedicated
for testing, so why bother.
- Captain Obvious
Time not spent testing is time spent doing something more useful
The first functional test I ran manually failed.
A developer trying to be lazy ? That's got to be the first time it happens.
A few interesting facts:
For new code, if I got lazy and tried to do manual tests first, it would take as long to fix the code as it would take to write all my TDD tests.
- But retesting a change manually took much more time
- And my coverage was very low
Oops, this test fixture
hid a defect.
Oh well, I'll add a quick TDD
tests to reproduce it and
we'll never see this defect again.
ADIOS
?
Why should this experience change, whether you are
One
or
One Hundred
Then, almost everything worked as expected.
Let's ship this release !