Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: When test-driven development just won't do

by dws (Chancellor)
on Aug 05, 2005 at 05:04 UTC ( #481085=note: print w/ replies, xml ) Need Help??


in reply to When test-driven development just won't do

The first case is when I've got a neat idea but I don't know how to implement it.

Assuming the neat idea is one that produces tangible results, write a functional test that invokes the "neat idea" code and makes some assertions about the results. Functional tests are good when you're making a cold start on an idea. They help you get started working from the outside in.

I sometimes start with a (functional) WWW::Mechanize test that invokes a CGI that doesn't exist yet, and makes some assertions about what the result looks like. Then I work inwards towards things that I can unit test. Often though, having a set of functional tests is sufficient.

Sometime if I find myself coding too far ahead, I'll stop and comment out the code I've just written. Then I'll write tests that give me a legitimate excuse to uncomment it bit by bit. It's not rare to discover that I've written stuff I don't really need. And occasionly, as you mention, a test will pass when it isn't expected to. Those end up being great opportunities for learning.


Comment on Re: When test-driven development just won't do
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://481085]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2015-07-05 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls