[TIP] the best time to start doing a test?

Tim Ottinger tottinge at gmail.com
Mon Sep 29 11:34:35 PDT 2008


Kumar McMillan wrote:
>
> I'd say you are probably beyond the point at which you should start
> writing tests so now is a good time to start.  
Heh:

Q: When is the best time to plant a tree?


> However, I [personally]
> find it important to leave breathing room when beginning a new area of
> development in a project -- in other words, I give myself time to
> explore the problem in code before writing tests.  I think of this as
> a prototype stage and the code might even get thrown away.  
When working in legacy code, we'll call this a "scratch refactoring", 
where we copy out the code and do bad things to it to figure out where 
we want to go.  Then we revert/delete the changes and start over TDD. I 
think that's listed as a technique in Working Effectively with Legacy 
Code (WELC).  If not, it should be.  Michael does it enough.

In Agile development, we will often do a "spike" which is when we go 
investigate a task to see if we can figure out an approach and give some 
kind of estimate for how big of a task it is.  That's the same thing in 
a different wrapper.  But everyone has to explore sometimes.

> Once I
> have a vision for the architecture then I start writing tests as soon
> as possible and add any new features with accompanying tests.  This is
> sort of like the TED (test enhanced development) that Grig and others
> described but it's got a bell curve to it where as soon as the
> architecture stabilizes it then becomes TDD (test driven development)
> for me.
>   
Once you decide that you're going to write the tests anyway, why _not_ 
write them first?





More information about the testing-in-python mailing list