Discussion:
Test Driven Development
sumujoshi
2005-03-28 17:29:29 UTC
Permalink
Ken,

We already have a huge code base for the application and we would like
to start practicing Test driven development. Now should we take a step
back and write tests for the existing code or start writing tests for
the future iterations...Any suggestions/recommendations will be
greatly appreciated.

Thanks,
Sumathi
Lasse Koskela
2005-03-28 18:39:17 UTC
Permalink
Sumathi,
Post by sumujoshi
We already have a huge code base for the application and we would like
to start practicing Test driven development. Now should we take a step
back and write tests for the existing code or start writing tests for
the future iterations...
In general, I'd say no -- don't start writing tests for the entire
existing code base, only write tests around the parts you need to deal
with *now*.

-Lasse-
Anthony Moralez
2005-03-28 19:40:01 UTC
Permalink
A great resource is Michael Feathers' book Working Effectively With
Legacy Code. He provides many techniques for working with code that
does not have tests yet. He gives heuristics for determining what to
test and how much to test. The most important point is to continue to
provide value to you customer while improving the existing code. Do
not drop everything to bring the entire system under test. Instead do
every new feature test-first and anytime you need to touch code
without tests take the time to hook them into your test harness. Then
you can write characterizing tests to provide support for change as
you go.

Good luck-
Anthony Moralez
sumujoshi
2005-03-28 21:18:52 UTC
Permalink
Thanks for the reply Anthony...I'll chech out this book.
Post by Anthony Moralez
A great resource is Michael Feathers' book Working Effectively With
Legacy Code. He provides many techniques for working with code that
does not have tests yet. He gives heuristics for determining what to
test and how much to test. The most important point is to continue to
provide value to you customer while improving the existing code. Do
not drop everything to bring the entire system under test. Instead do
every new feature test-first and anytime you need to touch code
without tests take the time to hook them into your test harness. Then
you can write characterizing tests to provide support for change as
you go.
Good luck-
Anthony Moralez
Kent Beck
2005-03-30 08:09:21 UTC
Permalink
Sumathi,

Thank you for the question. I recommend starting by writing tests for new
features and for defects that you are about to fix. That way you don't stop
producing value for your customers but you get some of the benefits of
testing. The first tests can be difficult to write because your design is
unlikely to be suited to testing. The times I've been in this situation, I
can always write tests if push myself. The tests are ugly at times, but ugly
tests are better than no tests.

Take care,

Kent Beck
Three Rivers Institute
-----Original Message-----
Sent: Monday, March 28, 2005 9:29 AM
Subject: [xpe2e] Test Driven Development
Ken,
We already have a huge code base for the application and we
would like
to start practicing Test driven development. Now should we
take a step
back and write tests for the existing code or start writing tests for
the future iterations...Any suggestions/recommendations will be
greatly appreciated.
Thanks,
Sumathi
Continue reading on narkive:
Loading...