[TIP] Interface vs Implementation Testing

Kumar McMillan kumar.mcmillan at gmail.com
Tue Apr 24 07:28:28 PDT 2007


On 4/24/07, Max Ischenko <ischenko at gmail.com> wrote:
> >
> > So, isn't this kind of an argument for functional and regression tests
> > only?

yes!  and ... no.  OK, maybe

> >
> > (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.

In addition to what Max says here I think he also hit the nail on the
head earlier in the thread explaining how functional tests deliver
binary answers: it worked vs. it didn't work.  Unit tests often give
you better answers, like "it didn't work because the message queue
isn't saving messages when you send it more than 5 at a time."

The bottom line for me is still that functional tests have the most
value when a project is young and in a growth spurt; they are also the
easiest to maintain.  I have a project at work now that has grown
beyond that stage.  Making changes is still easy because it has a
large suite of tests.  However, the test suite is about 85% functional
so is slow to run (hurts when I'm on a slower machine, heh) and it's a
little difficult to develop with the failing tests because you have to
dig in deeper.  In other words, I would love to have more unit tests
for it.  In fact, it would be ideal if I had enough unit tests so that
I could just run those while developing and let the slower functional
tests run in buildbot.

k



More information about the testing-in-python mailing list