On 1/24/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi > > Sorry if this is a bit off topic but as unit testing is such a > cornerstone of python development I thought a few of you may be able > to share your knowledge/experiences.
Test driven development, simplistically, means to write the tests before you write the code. > I like the concept of TDD but find it difficult to put into practice > most of the time. I think this primarily because I tend to like top- > down development and functional/object decomposition and TDD feels > more like a bottom-up approach. It should work with any unit of development, although it can be hard to usefully test high-level functionality that depends on currently unimplemented underware. > So my question is when approaching a project that you want to employ > test driven development on how and where do you start? And also if > anyone uses top-down design with TDD I would be interested in how you > do it (does it involve lots of mock objects/ is the first test you > write the last one to pass)? The system I've adopted is to use inline doctests for the simplest, tutorial-like examples, with "outline" unit tests composd to verify implementation details and to probe bounderies. Typically, I write a doctest, then the routine, and finally the unit tests. Top-down should work fine with test-driven, although your highest level tests will fail until your low-level tests pass. All the failing tests might be kind of depressing, though. Personally, I haven't really given top-down a fair shake, so I don't know which approach reveals my stupid design mistakes faster. -- Neil Cerutti <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list