in reply to OT: TDD question
The central point of TDD (at least as I understand it) is to write tests which verify your assumptions about what your code will do. This way you have a way of verifying that your code behaves as you would expect it to.
Now, at this point, I realize that before I get much further, I have to write like 3 more tests to get anywhere close to Devel::Cover's strident call. And, that's just with the minimum needed to satisfy the first test!
Thats the thing about Devel::Cover, it shows you exactly what you test code is running. Testing your "assumptions" will likely not test all your code, and this is where Devel::Cover comes in.
Personally, my approach is not true TDD. I like to write some code before I write tests so that I have something to work off of. At that point I proceed going back and forth between writing code and tests, sometimes tests first, other times code first depending upon where my inspiration is taking me. I still consider this TDD since test writing is still an integral and driving part of my process.
Only after I feel like I have something reasonably completed (not finished, but complete for that stage of development) do I run Devel::Cover. At that point I start writing tests again to fill in the missing coverage.
Now the reason I wait until (almost) the end to run Devel::Cover is that many times code which may not be run (covered) in one set of tests, will be run (covered) with another. So many times it may not make sense to write tests to cover that code at that point anyway.
The process of writing tests for code which is not covered under my basic "assumptions" usually leads to several things.
|
|---|