[TIP] Interface vs Implementation Testing

Max Ischenko ischenko at gmail.com
Mon Apr 23 23:01:11 PDT 2007


On 4/24/07, Titus Brown <titus at caltech.edu> wrote:
>
> -> I coded a huge test suite once that primarily unit tested
> -> implementation.  Since there were many tests, any time I wanted to
> -> change the way the app was implemented (faster algorithm here, don't
> -> need this class anymore, more methods now because of feature X) I
> -> usually ended up spending a good deal of time updating and deleting
> -> tests.  This just seemed unecessary to me and deterred me from relying
> -> on the test suite as an indication of successful functionality.
>
> So, isn't this kind of an argument for functional and regression tests
> only?
>
> (I'm honestly curious.  I haven't found much of a need for unit tests in
> my own code.)


Functional tests work great when testing "base path" through the system. But
they don't work that great testing corner cases, unexpected conditions and
branch logic.

You can write unit tests which exercise a function/module with (all)
different code paths. The more high-level the test the less feasible it
becomes: number of permutations explodes and many code paths simply aren't
(easily) reachable from the top-level. That off-the-beaten-path code still
needs to be tested and there is no better tool for that than unit tests.

YMMV, of course.

Max.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/testing-in-python/attachments/20070424/70f0ac28/attachment.htm 


More information about the testing-in-python mailing list